[llvm] [InstCombine] Fold Xor with or disjoint (PR #105992)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 01:30:11 PDT 2024


================
@@ -4693,7 +4693,19 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
   // calls in there are unnecessary as SimplifyDemandedInstructionBits should
   // have already taken care of those cases.
   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
-  Value *M;
+  Value *X, *Y, *M;
+
+  // (A | B) ^ C -> (A ^ C) ^ B
+  // C ^ (A | B) -> B ^ (A ^ C)
----------------
nikic wrote:

```suggestion
  // (X | Y) ^ M -> (X ^ M) ^ Y
  // (X | Y) ^ M -> (Y ^ M) ^ X
```
Try to use the same names as in the code to make it easier to compare.

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


More information about the llvm-commits mailing list