[ValueTracking] reduce code in isImpliedCondICmps; NFC
authorSanjay Patel <spatel@rotateright.com>
Thu, 4 Aug 2022 20:23:09 +0000 (16:23 -0400)
committerSanjay Patel <spatel@rotateright.com>
Thu, 4 Aug 2022 21:03:42 +0000 (17:03 -0400)
This copies the implementation of the subsequent match with constants.

llvm/lib/Analysis/ValueTracking.cpp

index 2dd671b..1808f48 100644 (file)
@@ -6688,14 +6688,8 @@ static Optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
 
   // Can we infer anything when the two compares have matching operands?
   bool AreSwappedOps;
-  if (isMatchingOps(ALHS, ARHS, BLHS, BRHS, AreSwappedOps)) {
-    if (Optional<bool> Implication = isImpliedCondMatchingOperands(
-            APred, BPred, AreSwappedOps))
-      return Implication;
-    // No amount of additional analysis will infer the second condition, so
-    // early exit.
-    return None;
-  }
+  if (isMatchingOps(ALHS, ARHS, BLHS, BRHS, AreSwappedOps))
+    return isImpliedCondMatchingOperands(APred, BPred, AreSwappedOps);
 
   // Can we infer anything when the LHS operands match and the RHS operands are
   // constants (not necessarily matching)?
@@ -6705,6 +6699,7 @@ static Optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
 
   if (APred == BPred)
     return isImpliedCondOperands(APred, ALHS, ARHS, BLHS, BRHS, DL, Depth);
+
   return None;
 }