aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopRotationUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopRotationUtils.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index d96c101..d2a2e40 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -259,9 +259,10 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
return false;
// Anything ScalarEvolution may know about this loop or the PHI nodes
- // in its header will soon be invalidated.
+ // in its header will soon be invalidated, and it can also affect its parent
+ // loops as well.
if (SE)
- SE->forgetLoop(L);
+ SE->forgetTopmostLoop(L);
DEBUG(dbgs() << "LoopRotation: rotating "; L->dump());
@@ -476,6 +477,12 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
DEBUG(dbgs() << "LoopRotation: into "; L->dump());
+#ifndef NDEBUG
+ // Make sure that after all our transforms SE is correct.
+ if (SE)
+ SE->verify();
+#endif
+
++NumRotated;
return true;
}