[llvm] [InstCombine] fold `(icmp eq/ne (or disjoint x, C0), C1)` -> `(icmp eq/ne x, C0^C1)` (PR #87734)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 7 12:18:56 PDT 2024


================
@@ -2049,6 +2050,16 @@ Instruction *InstCombinerImpl::foldICmpOrConstant(ICmpInst &Cmp,
   }
 
   Value *OrOp0 = Or->getOperand(0), *OrOp1 = Or->getOperand(1);
+
+  // (icmp eq/ne (or disjoint x, C0), C1)
----------------
goldsteinn wrote:

We can't move w.o a non-trivial refactor. Otherwise we hit the `X | C == C1` -> `X & ~C == C1 ^ C0` fold first.

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


More information about the llvm-commits mailing list