diff options
author | Florian Hahn <flo@fhahn.com> | 2025-05-27 10:46:27 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2025-05-27 10:46:28 +0100 |
commit | ac9a466e39bf97ffeab127982aa7c405cb257551 (patch) | |
tree | c9f160a672ff836ca4a1572a413f6219e82703dd /llvm/lib/Transforms/Utils/LoopPeel.cpp | |
parent | 6da8f3bd5df2bb860f8cc32e9cfc739baf102295 (diff) | |
download | llvm-ac9a466e39bf97ffeab127982aa7c405cb257551.zip llvm-ac9a466e39bf97ffeab127982aa7c405cb257551.tar.gz llvm-ac9a466e39bf97ffeab127982aa7c405cb257551.tar.bz2 |
[LoopPeel] Insert new phis before first non-PHI when peeling last iter.
Make sure the new phis are inserted before any non-phi instructions.
This fixes a crash when dbg_value instructions are present in the
original exit block.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopPeel.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopPeel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp index e1dc052..4d43c6a 100644 --- a/llvm/lib/Transforms/Utils/LoopPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp @@ -922,7 +922,7 @@ static void cloneLoopBlocks( // InsertTop, using the incoming value from the preheader for the original // preheader (when skipping the main loop) and the incoming value from the // latch for the latch (when continuing from the main loop). - IRBuilder<> B(InsertTop->getTerminator()); + IRBuilder<> B(InsertTop, InsertTop->getFirstNonPHIIt()); for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) { PHINode *NewPHI = cast<PHINode>(VMap[&*I]); PHINode *PN = B.CreatePHI(NewPHI->getType(), 2); |