mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Set NSW/NUW flags on SCEVAddExpr when the operation is flagged as
such. I'm doing this now for completeness because I can't think of/remember any reason that it was left out. I'm not sure it will help anything, but if we don't do it we need to explain why in comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139450 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e3734e2d9
commit
543376743c
@ -3546,7 +3546,13 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
|
|||||||
AddOps.push_back(Op1);
|
AddOps.push_back(Op1);
|
||||||
}
|
}
|
||||||
AddOps.push_back(getSCEV(U->getOperand(0)));
|
AddOps.push_back(getSCEV(U->getOperand(0)));
|
||||||
return getAddExpr(AddOps);
|
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap;
|
||||||
|
OverflowingBinaryOperator *OBO = cast<OverflowingBinaryOperator>(V);
|
||||||
|
if (OBO->hasNoSignedWrap())
|
||||||
|
setFlags(Flags, SCEV::FlagNSW);
|
||||||
|
if (OBO->hasNoUnsignedWrap())
|
||||||
|
setFlags(Flags, SCEV::FlagNUW);
|
||||||
|
return getAddExpr(AddOps, Flags);
|
||||||
}
|
}
|
||||||
case Instruction::Mul: {
|
case Instruction::Mul: {
|
||||||
// See the Add code above.
|
// See the Add code above.
|
||||||
|
Loading…
Reference in New Issue
Block a user