]> granicus.if.org Git - llvm/commitdiff
[ValueTracking] Use ConstantRange methods; NFC
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 9 Apr 2019 07:13:09 +0000 (07:13 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 9 Apr 2019 07:13:09 +0000 (07:13 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357969 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ValueTracking.cpp

index 23835bd8676c560010f481d2b27c9d6006cded58..ce55b9ee96a00ebbafe1725f59ee685190b40012 100644 (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) ||