mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
In ChangeCompareStride, when the stride to be reused is truncated to
a smaller type, promoted its offset back up to the type of the new comparison. This fixes PR4222. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72493 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2005,11 +2005,16 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond,
|
||||
ConstantInt *CI = ConstantInt::get(NewCmpIntTy, NewCmpVal);
|
||||
NewCmpRHS = ConstantExpr::getIntToPtr(CI, NewCmpTy);
|
||||
}
|
||||
NewOffset = CondUse->getOffset();
|
||||
if (CondUse->isSigned())
|
||||
NewOffset = SE->getNoopOrSignExtend(CondUse->getOffset(), NewCmpTy);
|
||||
else
|
||||
NewOffset = SE->getNoopOrZeroExtend(CondUse->getOffset(), NewCmpTy);
|
||||
NewOffset = TyBits == NewTyBits
|
||||
? SE->getMulExpr(CondUse->getOffset(),
|
||||
? SE->getMulExpr(NewOffset,
|
||||
SE->getConstant(ConstantInt::get(CmpTy, Scale)))
|
||||
: SE->getConstant(ConstantInt::get(NewCmpIntTy,
|
||||
cast<SCEVConstant>(CondUse->getOffset())->getValue()
|
||||
cast<SCEVConstant>(NewOffset)->getValue()
|
||||
->getSExtValue()*Scale));
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user