Tell ScalarEvolution to forget everything it knows about a loop before
authorDan Gohman <gohman@apple.com>
Sun, 27 Sep 2009 15:37:03 +0000 (15:37 +0000)
committerDan Gohman <gohman@apple.com>
Sun, 27 Sep 2009 15:37:03 +0000 (15:37 +0000)
rotating the loop, since loop rotation is a very significant change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82901 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopRotation.cpp

index 34ba48c6b05b93aca57aedd104dcd78d7b362f79..70c69bb1dae0016735483fc40806cf2288ef668a 100644 (file)
@@ -177,6 +177,11 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
 
   // Now, this loop is suitable for rotation.
 
+  // Anything ScalarEvolution may know about this loop or the PHI nodes
+  // in its header will soon be invalidated.
+  if (ScalarEvolution *SE = getAnalysisIfAvailable<ScalarEvolution>())
+    SE->forgetLoopBackedgeTakenCount(L);
+
   // Find new Loop header. NewHeader is a Header's one and only successor
   // that is inside loop.  Header's other successor is outside the
   // loop.  Otherwise loop is not suitable for rotation.