[llvm-commits] [llvm] r54380 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Dan Gohman gohman at apple.com
Tue Aug 5 15:34:21 PDT 2008


Author: djg
Date: Tue Aug  5 17:34:21 2008
New Revision: 54380

URL: http://llvm.org/viewvc/llvm-project?rev=54380&view=rev
Log:
Pass the computed iteration count value to RewriteLoopExitValues
instead of having it call getIterationCount again.

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

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Tue Aug  5 17:34:21 2008
@@ -90,7 +90,7 @@
                                     std::set<Instruction*> &DeadInsts);
     Instruction *LinearFunctionTestReplace(Loop *L, SCEV *IterationCount,
                                            SCEVExpander &RW);
-    void RewriteLoopExitValues(Loop *L);
+    void RewriteLoopExitValues(Loop *L, SCEV *IterationCount);
 
     void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts);
   };
@@ -303,7 +303,7 @@
 /// final value of any expressions that are recurrent in the loop, and
 /// substitute the exit values from the loop into any instructions outside of
 /// the loop that use the final values of the current expressions.
-void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
+void IndVarSimplify::RewriteLoopExitValues(Loop *L, SCEV *IterationCount) {
   BasicBlock *Preheader = L->getLoopPreheader();
 
   // Scan all of the instructions in the loop, looking at those that have
@@ -321,7 +321,7 @@
     BlockToInsertInto = Preheader;
   BasicBlock::iterator InsertPt = BlockToInsertInto->getFirstNonPHI();
 
-  bool HasConstantItCount = isa<SCEVConstant>(SE->getIterationCount(L));
+  bool HasConstantItCount = isa<SCEVConstant>(IterationCount);
 
   std::set<Instruction*> InstructionsToDelete;
   std::map<Instruction*, Value*> ExitValues;
@@ -458,7 +458,7 @@
   //
   SCEVHandle IterationCount = SE->getIterationCount(L);
   if (!isa<SCEVCouldNotCompute>(IterationCount))
-    RewriteLoopExitValues(L);
+    RewriteLoopExitValues(L, IterationCount);
 
   // Next, analyze all of the induction variables in the loop, canonicalizing
   // auxillary induction variables.





More information about the llvm-commits mailing list