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
This commit is contained in:
Evan Cheng 2006-06-09 00:12:42 +00:00
parent a452932171
commit 86c75d3113

View File

@ -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