[llvm] e07a9b3 - [InstCombine] Add PR45984 test case

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 05:05:43 PDT 2021


Author: Simon Pilgrim
Date: 2021-04-06T13:05:29+01:00
New Revision: e07a9b38a6892136fceae0ee17fea0530b6f7623

URL: https://github.com/llvm/llvm-project/commit/e07a9b38a6892136fceae0ee17fea0530b6f7623
DIFF: https://github.com/llvm/llvm-project/commit/e07a9b38a6892136fceae0ee17fea0530b6f7623.diff

LOG: [InstCombine] Add PR45984 test case

Fold (a ^ b) | ~(a | b) --> ~(a & b)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/demorgan.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/demorgan.ll b/llvm/test/Transforms/InstCombine/demorgan.ll
index 809c43d1a09df..dd04d49903706 100644
--- a/llvm/test/Transforms/InstCombine/demorgan.ll
+++ b/llvm/test/Transforms/InstCombine/demorgan.ll
@@ -515,3 +515,17 @@ define <4 x i32> @demorgan_plus_and_to_xor_vec(<4 x i32> %a, <4 x i32> %b) {
   ret <4 x i32> %not
 }
 
+; (a ^ b) | ~(a | b) --> ~(a & b)
+
+define i32 @PR45984(i32 %0, i32 %1) {
+; CHECK-LABEL: @PR45984(
+; CHECK-NEXT:    [[TMP3:%.*]] = and i32 [[TMP1:%.*]], [[TMP0:%.*]]
+; CHECK-NEXT:    [[TMP4:%.*]] = xor i32 [[TMP3]], -1
+; CHECK-NEXT:    ret i32 [[TMP4]]
+;
+  %3 = xor i32 %1, %0
+  %4 = or i32 %1, %0
+  %5 = xor i32 %4, -1
+  %6 = or i32 %3, %5
+  ret i32 %6
+}


        


More information about the llvm-commits mailing list