aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2022-06-29 20:28:42 +0100
committerFlorian Hahn <flo@fhahn.com>2022-06-29 20:28:43 +0100
commit6d5f814357df461f32c317a94ada1704ec4c2846 (patch)
treeea24c68e57ab7de0e0c43d5527d26810f0428031 /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
parent9c6e04359282e9051f7b2744b99266ece32db001 (diff)
downloadllvm-6d5f814357df461f32c317a94ada1704ec4c2846.zip
llvm-6d5f814357df461f32c317a94ada1704ec4c2846.tar.gz
llvm-6d5f814357df461f32c317a94ada1704ec4c2846.tar.bz2
[LoopUnrollRuntime] Invalidate SCEV for exit phi in ConnectProlog.
ConnectProlog adds new incoming values to exit phi nodes which can change the SCEV for the phi after 20d798bd47ec51. Fix is analog to cfc741bc0e029. Fixes #56286.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
index 79f4357..cd3b6c1 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -73,7 +73,8 @@ static void ConnectProlog(Loop *L, Value *BECount, unsigned Count,
BasicBlock *OriginalLoopLatchExit,
BasicBlock *PreHeader, BasicBlock *NewPreHeader,
ValueToValueMapTy &VMap, DominatorTree *DT,
- LoopInfo *LI, bool PreserveLCSSA) {
+ LoopInfo *LI, bool PreserveLCSSA,
+ ScalarEvolution &SE) {
// Loop structure should be the following:
// Preheader
// PrologHeader
@@ -133,6 +134,7 @@ static void ConnectProlog(Loop *L, Value *BECount, unsigned Count,
PN.setIncomingValueForBlock(NewPreHeader, NewPN);
else
PN.addIncoming(NewPN, PrologExit);
+ SE.forgetValue(&PN);
}
}
@@ -927,7 +929,7 @@ bool llvm::UnrollRuntimeLoopRemainder(
// Connect the prolog code to the original loop and update the
// PHI functions.
ConnectProlog(L, BECount, Count, PrologExit, LatchExit, PreHeader,
- NewPreHeader, VMap, DT, LI, PreserveLCSSA);
+ NewPreHeader, VMap, DT, LI, PreserveLCSSA, *SE);
}
// If this loop is nested, then the loop unroller changes the code in the any