Fix Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll, a crash

on 177.mesa

llvm-svn: 22843
This commit is contained in:
Chris Lattner 2005-08-17 21:22:41 +00:00
parent 9b2efaf9c8
commit ea7dfd53d6
1 changed files with 4 additions and 1 deletions

View File

@ -744,7 +744,10 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
// value of the IV. Do not put anything in the base, make sure it's all in
// the immediate field to allow as much factoring as possible.
if (!L->contains(UsersToProcess[i].Inst->getParent())) {
std::swap(UsersToProcess[i].Base, UsersToProcess[i].Imm);
UsersToProcess[i].Imm = SCEVAddExpr::get(UsersToProcess[i].Imm,
UsersToProcess[i].Base);
UsersToProcess[i].Base =
SCEVUnknown::getIntegerSCEV(0, UsersToProcess[i].Base->getType());
} else {
// Addressing modes can be folded into loads and stores. Be careful that