aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2024-02-26 15:20:55 +0000
committerGitHub <noreply@github.com>2024-02-26 15:20:55 +0000
commit1253e535bd421b955cce1c67ed4304f2ae9bcdfd (patch)
tree20832f509fc215356a10ab624bd1635328074dd7 /llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
parent969d7ecf0b1d51e04e774b0695ffc1d04af81bde (diff)
downloadllvm-1253e535bd421b955cce1c67ed4304f2ae9bcdfd.zip
llvm-1253e535bd421b955cce1c67ed4304f2ae9bcdfd.tar.gz
llvm-1253e535bd421b955cce1c67ed4304f2ae9bcdfd.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
index 3c06a6e..26b8c79 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
@@ -473,9 +473,9 @@ llvm::UnrollAndJamLoop(Loop *L, unsigned Count, unsigned TripCount,
};
// Move all the phis from Src into Dest
auto movePHIs = [](BasicBlock *Src, BasicBlock *Dest) {
- Instruction *insertPoint = Dest->getFirstNonPHI();
+ BasicBlock::iterator insertPoint = Dest->getFirstNonPHIIt();
while (PHINode *Phi = dyn_cast<PHINode>(Src->begin()))
- Phi->moveBefore(insertPoint);
+ Phi->moveBefore(*Dest, insertPoint);
};
// Update the PHI values outside the loop to point to the last block