diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 23f75630b76..4365adc629f 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2027,10 +2027,9 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond, Scale = SSInt / CmpSSInt; int64_t NewCmpVal = CmpVal * Scale; - APInt Mul = APInt(BitWidth*2, CmpVal); - Mul = Mul * APInt(BitWidth*2, Scale); + APInt Mul = APInt(BitWidth, NewCmpVal); // Check for overflow. - if (!Mul.isSignedIntN(BitWidth)) + if (Mul.getSExtValue() != NewCmpVal) continue; // Watch out for overflow. |

