[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:
Nikita Popov 2019-04-09 07:13:09 +00:00
parent 7bd7878d22
commit 6e9157d588
1 changed files with 3 additions and 3 deletions

View File

@ -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) ||