aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils/LCSSA.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils/LCSSA.cpp')
-rw-r--r--lib/Transforms/Utils/LCSSA.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp
index 833dea5..38c1495 100644
--- a/lib/Transforms/Utils/LCSSA.cpp
+++ b/lib/Transforms/Utils/LCSSA.cpp
@@ -255,6 +255,11 @@ bool LCSSA::ProcessInstruction(Instruction *Inst,
if (Loop *L = LI->getLoopFor(ExitBB))
SE->forgetLoop(L);
}
+
+ // If we added a PHI, drop the cache to avoid invalidating SCEV caches.
+ // FIXME: This is a big hammer, can we clear the cache more selectively?
+ if (SE && !AddedPHIs.empty())
+ SE->forgetLoop(L);
// Rewrite all uses outside the loop in terms of the new PHIs we just
// inserted.