[llvm] [InstCombine] Reduce the expression `(a^c1)&(a^~c1)` to zero (PR #76637)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 30 15:24:30 PST 2023


================
@@ -40,3 +40,14 @@ define i32 @PR38781(i32 %a, i32 %b) {
   %and = and i32 %b.lobit.not, %a.lobit.not
   ret i32 %and
 }
+
+; (a ^ 4) & (a ^ ~4) -> 0
----------------
dtcxzyw wrote:

1. Please make these tests a separate commit. Then apply the `InstCombine` changes and update the check lines in the second commit.
I.e
Commit 1: [InstSimplify] Add pre-commit tests for PR75692. NFC.
Commit 2: [InstSimplify] Fold `(X ^ C) & (X ^ ~C)` into zero
3. Please generate check lines using `llvm/utils/update_test_checks.py`
4. Please add some negative tests, e.g., `(X ^ 4) & (X ^ 3)` and `(X ^ 4) & (Y ^ -5)`.


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


More information about the llvm-commits mailing list