diff options
| author | Zhou Sheng <zhousheng00@gmail.com> | 2007-06-27 09:50:26 +0000 |
|---|---|---|
| committer | Zhou Sheng <zhousheng00@gmail.com> | 2007-06-27 09:50:26 +0000 |
| commit | 8d438858c8946d4be168202d304ac7dbeaf8b1b8 (patch) | |
| tree | 1595b242edb51e3d4d7acd84dde885c81074cd8b /llvm/lib | |
| parent | 95759c0e78d3097c0e503f92e28ebcd19c42585d (diff) | |
| download | bcm5719-llvm-8d438858c8946d4be168202d304ac7dbeaf8b1b8.tar.gz bcm5719-llvm-8d438858c8946d4be168202d304ac7dbeaf8b1b8.zip | |
Fix a bug.
llvm-svn: 37751
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index f0019052d8f..01b74815f52 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/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); } |

