[llvm] r357969 - [ValueTracking] Use ConstantRange methods; NFC
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 00:13:09 PDT 2019
Author: nikic
Date: Tue Apr 9 00:13:09 2019
New Revision: 357969
URL: http://llvm.org/viewvc/llvm-project?rev=357969&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=357969&r1=357968&r2=357969&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Apr 9 00:13:09 2019
@@ -4154,11 +4154,11 @@ static OverflowResult computeOverflowFor
// 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) ||
More information about the llvm-commits
mailing list