aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index c235d2fb2a5b..f99f4487c554 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -1249,8 +1249,9 @@ static BasicBlock *buildClonedLoopBlocks(
assert(VMap.lookup(&I) == &ClonedI && "Mismatch in the value map!");
// Forget SCEVs based on exit phis in case SCEV looked through the phi.
- if (SE && isa<PHINode>(I))
- SE->forgetValue(&I);
+ if (SE)
+ if (auto *PN = dyn_cast<PHINode>(&I))
+ SE->forgetLcssaPhiWithNewPredecessor(&L, PN);
BasicBlock::iterator InsertPt = MergeBB->getFirstInsertionPt();