diff options
| author | David Greene <greened@obbligato.org> | 2009-05-06 17:39:26 +0000 |
|---|---|---|
| committer | David Greene <greened@obbligato.org> | 2009-05-06 17:39:26 +0000 |
| commit | 0dec5b9a7563334abd3c7e28cff4d6d38bb5a913 (patch) | |
| tree | 3edcb90a0bf47cc733d0c522a817a640a74ae323 /llvm/lib/Transforms | |
| parent | 9a6fef0a52e705f6ac0c4b181adb1b1948add802 (diff) | |
| download | bcm5719-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.cpp | 5 |
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. |

