[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 7 22:48:00 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.38 -> 1.39
---
Log message:

Implement LoopStrengthReduce/share_code_in_preheader.ll by having one 
rewriter for all code inserted into the preheader, which is never flushed.


---
Diffs of the changes:  (+4 -1)

 LoopStrengthReduce.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.38 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.39
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.38	Mon Aug  8 00:28:22 2005
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Mon Aug  8 00:47:49 2005
@@ -542,6 +542,8 @@
   }
 
   SCEVExpander Rewriter(*SE, *LI);
+  SCEVExpander PreheaderRewriter(*SE, *LI);
+
   BasicBlock  *Preheader = L->getLoopPreheader();
   Instruction *PreInsertPt = Preheader->getTerminator();
   Instruction *PhiInsertBefore = L->getHeader()->begin();
@@ -578,7 +580,8 @@
 
     // Emit the initial base value into the loop preheader, and add it to the
     // Phi node.
-    Value *BaseV = Rewriter.expandCodeFor(Base, PreInsertPt, ReplacedTy);
+    Value *BaseV = PreheaderRewriter.expandCodeFor(Base, PreInsertPt,
+                                                   ReplacedTy);
     NewPHI->addIncoming(BaseV, Preheader);
 
     // Emit the increment of the base value before the terminator of the loop






More information about the llvm-commits mailing list