]> granicus.if.org Git - llvm/commitdiff
[LazyValueInfo] Don't run the more complex predicate handling code for EQ and NE...
authorCraig Topper <craig.topper@intel.com>
Fri, 9 Jun 2017 16:16:20 +0000 (16:16 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 9 Jun 2017 16:16:20 +0000 (16:16 +0000)
Summary:
Unless I'm mistaken, the special handling for EQ/NE should cover everything and there is no reason to fallthrough to the more complex code. For that matter I'm not sure there's any reason to special case EQ/NE other than avoiding creating temporary ConstantRanges.

This patch moves the complex code into an else so we only do it when we are handling a predicate other than EQ/NE.

Reviewers: anna, reames, resistor, Farhana

Reviewed By: anna

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34000

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

lib/Analysis/LazyValueInfo.cpp

index 87e7f9bf0af7aa6a2098a47f7d559fde560ddd75..de5d80b2dd5f4426e59d922854cddafb69160be0 100644 (file)
@@ -1692,15 +1692,15 @@ static LazyValueInfo::Tristate getPredicateResult(unsigned Pred, Constant *C,
 
       if (CR.isSingleElement())
         return LazyValueInfo::False;
+    } else {
+      // Handle more complex predicates.
+      ConstantRange TrueValues = ConstantRange::makeExactICmpRegion(
+          (ICmpInst::Predicate)Pred, CI->getValue());
+      if (TrueValues.contains(CR))
+        return LazyValueInfo::True;
+      if (TrueValues.inverse().contains(CR))
+        return LazyValueInfo::False;
     }
-
-    // Handle more complex predicates.
-    ConstantRange TrueValues = ConstantRange::makeExactICmpRegion(
-        (ICmpInst::Predicate)Pred, CI->getValue());
-    if (TrueValues.contains(CR))
-      return LazyValueInfo::True;
-    if (TrueValues.inverse().contains(CR))
-      return LazyValueInfo::False;
     return LazyValueInfo::Unknown;
   }