aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-06-27 09:50:26 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-06-27 09:50:26 +0000
commit0d7d3656f3d10c510353d69472de4c0c0691b2e6 (patch)
treed816b21f28d5b301570a01fb436b65dfb499e58c
parentdf82c93f2a37f9f52c8210eef9404b4a265a415f (diff)
Fix a bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37751 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index f0019052d8..01b74815f5 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -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);
}