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

Amr Hesham via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 01:54:46 PDT 2024


================
@@ -1485,3 +1485,171 @@ define i4 @PR96857_xor_without_noundef(i4  %val0, i4  %val1, i4 %val2) {
   %val7 = xor i4 %val4, %val6
   ret i4 %val7
 }
+
+define i32 @or_disjoint_with_xor(i32 %a, i32 %b) {
+; CHECK-LABEL: @or_disjoint_with_xor(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    ret i32 [[B:%.*]]
+;
+entry:
+  %or = or disjoint i32 %a, %b
+  %xor = xor i32 %or, %a
+  ret i32 %xor
+}
+
+define i32 @xor_with_or_disjoint(i32 %a, i32 %b, i32 %c) {
+; CHECK-LABEL: @xor_with_or_disjoint(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    ret i32 [[B:%.*]]
+;
+entry:
+  %or = or disjoint i32 %a, %b
----------------
AmrDeveloper wrote:

Done

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


More information about the llvm-commits mailing list