diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-06-09 00:12:42 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-06-09 00:12:42 +0000 |
commit | 86c75d31133319a88216c1b1cd26a789e4023000 (patch) | |
tree | 4b6528872a350bb0ed175d23474c12ecc372bf74 /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | a4529321713313545f53ee759800705bdb3f2a29 (diff) | |
download | llvm-86c75d31133319a88216c1b1cd26a789e4023000.tar.gz llvm-86c75d31133319a88216c1b1cd26a789e4023000.tar.bz2 llvm-86c75d31133319a88216c1b1cd26a789e4023000.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28735 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index d3ac797651..6e4460b509 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1074,6 +1074,9 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride, 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 |