forked from OSchip/llvm-project
[ValueTracking] Use ConstantRange methods; NFC
Switch part of the computeOverflowForSignedAdd() implementation to use Range.isAllNegative() rather than KnownBits.isNegative() and similar. They do the same thing, but using the ConstantRange methods allows dropping the KnownBits variables more easily in D60420. llvm-svn: 357969
This commit is contained in:
parent
7bd7878d22
commit
6e9157d588
|
@ -4154,11 +4154,11 @@ static OverflowResult computeOverflowForSignedAdd(const Value *LHS,
|
|||
// The only other way to improve on the known bits is from an assumption, so
|
||||
// call computeKnownBitsFromAssume() directly.
|
||||
bool LHSOrRHSKnownNonNegative =
|
||||
(LHSKnown.isNonNegative() || RHSKnown.isNonNegative());
|
||||
(LHSRange.isAllNonNegative() || RHSRange.isAllNonNegative());
|
||||
bool LHSOrRHSKnownNegative =
|
||||
(LHSKnown.isNegative() || RHSKnown.isNegative());
|
||||
(LHSRange.isAllNegative() || RHSRange.isAllNegative());
|
||||
if (LHSOrRHSKnownNonNegative || LHSOrRHSKnownNegative) {
|
||||
KnownBits AddKnown(LHSKnown.getBitWidth());
|
||||
KnownBits AddKnown(LHSRange.getBitWidth());
|
||||
computeKnownBitsFromAssume(
|
||||
Add, AddKnown, /*Depth=*/0, Query(DL, AC, CxtI, DT, true));
|
||||
if ((AddKnown.isNonNegative() && LHSOrRHSKnownNonNegative) ||
|
||||
|
|
Loading…
Reference in New Issue