mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Make sure to use signed arithmetic in APInt to fix a regression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71090 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e9d87f4906
commit
e19c840d6c
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user