aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 692a872..1b36a29b 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -693,12 +693,6 @@ ReprocessLoop:
}
}
- // Changing exit conditions for blocks may affect exit counts of this loop and
- // any of its paretns, so we must invalidate the entire subtree if we've made
- // any changes.
- if (Changed && SE)
- SE->forgetTopmostLoop(L);
-
if (MSSAU && VerifyMemorySSA)
MSSAU->getMemorySSA()->verifyMemorySSA();
@@ -737,6 +731,13 @@ bool llvm::simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI,
Changed |= simplifyOneLoop(Worklist.pop_back_val(), Worklist, DT, LI, SE,
AC, MSSAU, PreserveLCSSA);
+ // Changing exit conditions for blocks may affect exit counts of this loop and
+ // any of its parents, so we must invalidate the entire subtree if we've made
+ // any changes. Do this here rather than in simplifyOneLoop() as the top-most
+ // loop is going to be the same for all child loops.
+ if (Changed && SE)
+ SE->forgetTopmostLoop(L);
+
return Changed;
}