[llvm] [InstCombine] Fold (X ^ (or disjoint Y, C1)) ^ C2 to (X ^ Y) ^ (C1 ^ C2) (PR #191638)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 11 09:26:48 PDT 2026


================
@@ -5440,6 +5440,12 @@ Instruction *InstCombinerImpl::visitXor(BinaryOperator &I) {
           MaskedValueIsZero(X, *C, &I))
         return BinaryOperator::CreateXor(X, ConstantInt::get(Ty, *C ^ *RHSC));
 
+      // (X ^ (or disjoint Y, C1)) ^ C2 --> (X ^ Y) ^ (C1 ^ C2)
----------------
nikic wrote:

```suggestion
      // (X ^ (or disjoint Y, C)) ^ RHSC --> (X ^ Y) ^ (C ^ RHCS)
```
To match the implementation.

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


More information about the llvm-commits mailing list