Fix a bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zhou Sheng 2007-06-27 09:50:26 +00:00
parent df82c93f2a
commit 0d7d3656f3

View File

@ -519,8 +519,11 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
DOUT << "INDVARS: New CanIV: " << *IndVar;
if (!isa<SCEVCouldNotCompute>(IterationCount)) {
if (IterationCount->getType() != LargestType)
if (IterationCount->getType()->getPrimitiveSizeInBits() <
LargestType->getPrimitiveSizeInBits())
IterationCount = SCEVZeroExtendExpr::get(IterationCount, LargestType);
else if (IterationCount->getType() != LargestType)
IterationCount = SCEVTruncateExpr::get(IterationCount, LargestType);
if (Instruction *DI = LinearFunctionTestReplace(L, IterationCount,Rewriter))
DeadInsts.insert(DI);
}