[llvm-commits] [llvm] r70632 - /llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp

Dan Gohman gohman at apple.com
Sat May 2 10:29:27 PDT 2009


Author: djg
Date: Sat May  2 12:29:26 2009
New Revision: 70632

URL: http://llvm.org/viewvc/llvm-project?rev=70632&view=rev
Log:
Tell ScalarEvolution that the loop is being deleted before actually
deleting it.  This will let ScalarEvolution be more complete about
updating its records.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=70632&r1=70631&r2=70632&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Sat May  2 12:29:26 2009
@@ -258,6 +258,11 @@
     (*LI)->dropAllReferences();
   }
   
+  // Tell ScalarEvolution that the loop is deleted. Do this before
+  // deleting the loop so that ScalarEvolution can look at the loop
+  // to determine what it needs to clean up.
+  SE.forgetLoopBackedgeTakenCount(L);
+
   // Erase the instructions and the blocks without having to worry
   // about ordering because we already dropped the references.
   // NOTE: This iteration is safe because erasing the block does not remove its
@@ -266,9 +271,6 @@
        LI != LE; ++LI)
     (*LI)->eraseFromParent();
 
-  // Tell ScalarEvolution that the loop is deleted.
-  SE.forgetLoopBackedgeTakenCount(L);
-
   // Finally, the blocks from loopinfo.  This has to happen late because
   // otherwise our loop iterators won't work.
   LoopInfo& loopInfo = getAnalysis<LoopInfo>();





More information about the llvm-commits mailing list