[PATCH] D19073: [ValueTracking] Improve isImpliedCondition for conditions with matching LHS operands and Immediate RHS operands.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 17:03:53 PDT 2016


reames requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: lib/Analysis/ValueTracking.cpp:3791
@@ -3790,1 +3790,3 @@
 
+static bool isImpliedCondImmOperands(CmpInst::Predicate APred, Value *ALHS,
+                                     Value *ARHS, CmpInst::Predicate BPred,
----------------
Comments to explain what this function does?

================
Comment at: lib/Analysis/ValueTracking.cpp:3796
@@ +3795,3 @@
+  // The below logic assumes the ALHS == BLHS and both RHS are constants.
+  if (ALHS != BLHS || !isa<ConstantInt>(ARHS) || !isa<ConstantInt>(BRHS))
+    return false;
----------------
Shift this check into caller and pass in ConstantInt arguments as appropriate.  

================
Comment at: lib/Analysis/ValueTracking.cpp:3808
@@ +3807,3 @@
+
+    // If the constant operands match and the predicates are swapped we can
+    // infer the second condition is false because if, for example, A > 5 is
----------------
A more general framing of a lot of this logic would be to use ConstantFoldICmp.  This wouldn't require the code duplication and would be more general.  


http://reviews.llvm.org/D19073





More information about the llvm-commits mailing list