Skip to content

Commit 1253e53

Browse files
authored
[RemoveDIs] Use iterators for moving PHIs in loop-unroll-and-jam (#83003)
With no debug intrinsics, correctly identifying the start of a block with iterators becomes important. We need to use the iterator-returning methods here in loop-unroll-and-jam where we're shifting PHIs around. Otherwise they can be inserted after debug-info records, leading to debug-info attached to PHIs, which is ill formed. Fixes #83000
1 parent 969d7ec commit 1253e53

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ llvm::UnrollAndJamLoop(Loop *L, unsigned Count, unsigned TripCount,
473473
};
474474
// Move all the phis from Src into Dest
475475
auto movePHIs = [](BasicBlock *Src, BasicBlock *Dest) {
476-
Instruction *insertPoint = Dest->getFirstNonPHI();
476+
BasicBlock::iterator insertPoint = Dest->getFirstNonPHIIt();
477477
while (PHINode *Phi = dyn_cast<PHINode>(Src->begin()))
478-
Phi->moveBefore(insertPoint);
478+
Phi->moveBefore(*Dest, insertPoint);
479479
};
480480

481481
// Update the PHI values outside the loop to point to the last block

0 commit comments

Comments
 (0)