[llvm] 1908488 - [InstCombine] Add PR45977 test coverage
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 22 04:23:31 PST 2021
Author: Simon Pilgrim
Date: 2021-02-22T12:20:35Z
New Revision: 19084887d9222dab71c86ed848b09f9ca8e61fff
URL: https://github.com/llvm/llvm-project/commit/19084887d9222dab71c86ed848b09f9ca8e61fff
DIFF: https://github.com/llvm/llvm-project/commit/19084887d9222dab71c86ed848b09f9ca8e61fff.diff
LOG: [InstCombine] Add PR45977 test coverage
Added:
Modified:
llvm/test/Transforms/InstCombine/or-xor.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/or-xor.ll b/llvm/test/Transforms/InstCombine/or-xor.ll
index 2ec54c8d53e5..f0a3f58a83ec 100644
--- a/llvm/test/Transforms/InstCombine/or-xor.ll
+++ b/llvm/test/Transforms/InstCombine/or-xor.ll
@@ -472,3 +472,30 @@ define i8 @test23v(<2 x i8> %A) {
%E = xor i8 %D, 12
ret i8 %E
}
+
+; ~(a | b) | (~a & b);
+define i32 @PR45977_f1(i32 %a, i32 %b) {
+; CHECK-LABEL: @PR45977_f1(
+; CHECK-NEXT: [[NOT:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: ret i32 [[NOT]]
+;
+ %not = xor i32 %a, -1
+ %andnot = and i32 %not, %b
+ %or = or i32 %a, %b
+ %notor = xor i32 %or, -1
+ %res = or i32 %notor, %andnot
+ ret i32 %res
+}
+
+; (a | b) ^ (a | ~b)
+define i32 @PR45977_f2(i32 %a, i32 %b) {
+; CHECK-LABEL: @PR45977_f2(
+; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[A:%.*]], -1
+; CHECK-NEXT: ret i32 [[TMP1]]
+;
+ %or = or i32 %a, %b
+ %not = xor i32 %b, -1
+ %ornot = or i32 %a, %not
+ %res = xor i32 %or, %ornot
+ ret i32 %res
+}
More information about the llvm-commits
mailing list