summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-05-06 17:39:26 +0000
committerDavid Greene <greened@obbligato.org>2009-05-06 17:39:26 +0000
commit0dec5b9a7563334abd3c7e28cff4d6d38bb5a913 (patch)
tree3edcb90a0bf47cc733d0c522a817a640a74ae323 /llvm/lib/Transforms
parent9a6fef0a52e705f6ac0c4b181adb1b1948add802 (diff)
downloadbcm5719-llvm-0dec5b9a7563334abd3c7e28cff4d6d38bb5a913.tar.gz
bcm5719-llvm-0dec5b9a7563334abd3c7e28cff4d6d38bb5a913.zip
Make sure to use signed arithmetic in APInt to fix a regression.
llvm-svn: 71090
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index e2cbbc2d270..9e6f2b02bc8 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2027,9 +2027,10 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond,
Scale = SSInt / CmpSSInt;
int64_t NewCmpVal = CmpVal * Scale;
- APInt Mul = APInt(BitWidth, NewCmpVal);
+ APInt Mul = APInt(BitWidth*2, CmpVal, true);
+ Mul = Mul * APInt(BitWidth*2, Scale, true);
// Check for overflow.
- if (Mul.getSExtValue() != NewCmpVal)
+ if (!Mul.isSignedIntN(BitWidth)) {
continue;
// Watch out for overflow.
OpenPOWER on IntegriCloud