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

Evan Cheng evan.cheng at apple.com
Thu Jun 8 17:12:54 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.83 -> 1.84
---
Log message:

RewriteExpr, either the new PHI node of induction variable or the
post-increment value, should be first cast to the appropriated type (to the
type of the common expr). Otherwise, the rewrite of a use based on (common +
iv) may end up with an incorrect type.


---
Diffs of the changes:  (+3 -0)

 LoopStrengthReduce.cpp |    3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.83 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.84
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.83	Wed Apr 12 14:28:15 2006
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Thu Jun  8 19:12:42 2006
@@ -1074,6 +1074,9 @@
         if (L->contains(User.Inst->getParent()))
           User.Inst->moveBefore(LatchBlock->getTerminator());
       }
+      if (RewriteOp->getType() != ReplacedTy)
+        RewriteOp = SCEVExpander::InsertCastOfTo(RewriteOp, ReplacedTy);
+
       SCEVHandle RewriteExpr = SCEVUnknown::get(RewriteOp);
 
       // Clear the SCEVExpander's expression map so that we are guaranteed






More information about the llvm-commits mailing list