[PATCH] InstCombine: Combine two icmps into one if the RHSs agree

Chad Rosier mcrosier at codeaurora.org
Sat Aug 2 09:56:33 PDT 2014


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:814
@@ -826,5 +813,3 @@
 
-    // (icmp eq A, 0) & (icmp eq B, 0) --> (icmp eq (A|B), 0)
-    if (LHSCC == ICmpInst::ICMP_EQ && LHSCst->isZero()) {
-      Value *NewOr = Builder->CreateOr(Val, Val2);
-      return Builder->CreateICmp(LHSCC, NewOr, LHSCst);
+  // (icmp CC A, C) & (icmp CC B, C) --> (icmp CC (A|B), C)
+  if (LHS->getOperand(1) == RHS->getOperand(1) && LHSCC == RHSCC) {
----------------
Chad Rosier wrote:
> Also, do we need a check to make sure the CCs match?
Nevermind, I see the check now..

http://reviews.llvm.org/D4744






More information about the llvm-commits mailing list