fix a bug where we thought arguments were constants :(

llvm-svn: 20506
This commit is contained in:
Chris Lattner 2005-03-06 22:52:29 +00:00
parent 2ce303b406
commit 8c79559443
1 changed files with 7 additions and 3 deletions

View File

@ -154,15 +154,19 @@ void LoopStrengthReduce::strengthReduceGEP(GetElementPtrInst *GEPI, Loop *L,
inc_op_vector.push_back(ConstantInt::get(Ty, 1));
indvar = op;
break;
} else if (isa<Constant>(operand) || isa<Argument>(operand)) {
} else if (isa<Argument>(operand)) {
pre_op_vector.push_back(operand);
AllConstantOperands = false;
} else if (isa<Constant>(operand)) {
pre_op_vector.push_back(operand);
} else if (Instruction *inst = dyn_cast<Instruction>(operand)) {
if (!DS->dominates(inst, Preheader->getTerminator()))
return;
pre_op_vector.push_back(operand);
AllConstantOperands = false;
} else
return;
} else {
return; // Cannot handle this.
}
Cache = Cache->get(operand);
}
assert(indvar > 0 && "Indvar used by GEP not found in operand list");