[llvm] [InstSimplify] Simplify `icmp X & C1, X & C2` when `(C1 & C2) == C1/C2` (PR #65905)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 09:05:41 PDT 2023


================
@@ -3436,6 +3436,32 @@ static Value *simplifyICmpWithBinOp(CmpInst::Predicate Pred, Value *LHS,
       if (Value *V = simplifyICmpInst(Pred, LBO->getOperand(1),
                                       RBO->getOperand(1), Q, MaxRecurse - 1))
         return V;
+      break;
+    }
+    // icmp X & C1, X & C2 where (C1 & C2) == C1/C2
+    // icmp X | C1, X | C2 where (C1 & C2) == C1/C2
----------------
goldsteinn wrote:

In the title and here please fill in what you are transforming to.
Title also should indicate it works for `or` as well.

https://github.com/llvm/llvm-project/pull/65905


More information about the llvm-commits mailing list