Skip to content

Commit 4089314

Browse files
committed
[SandboxVec][DAG][NFC] Remove early return in notifyMoveInstr()
It used to early return when destination is same as origin. But it's redundant because in that case the callback won't get called in the first place.
1 parent 9883aa9 commit 4089314

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,11 @@ void DependencyGraph::notifyCreateInstr(Instruction *I) {
368368
}
369369

370370
void DependencyGraph::notifyMoveInstr(Instruction *I, const BBIterator &To) {
371-
// Early return if `I` doesn't actually move.
371+
// NOTE: This function runs before `I` moves to its new destination.
372372
BasicBlock *BB = To.getNodeParent();
373-
if (To != BB->end() && &*To == I->getNextNode())
374-
return;
373+
assert(!(To != BB->end() && &*To == I->getNextNode()) &&
374+
!(To == BB->end() && std::next(I->getIterator()) == BB->end()) &&
375+
"Should not have been called if destination is same as origin.");
375376

376377
// Maintain the DAGInterval.
377378
DAGInterval.notifyMoveInstr(I, To);

0 commit comments

Comments
 (0)