[llvm] 88c2454 - [InstCombine] Add PR38929 test case
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 6 06:43:31 PDT 2021
Author: Simon Pilgrim
Date: 2021-04-06T14:42:30+01:00
New Revision: 88c2454057b6cd1b122f7fadde666e6b8ea6ebd3
URL: https://github.com/llvm/llvm-project/commit/88c2454057b6cd1b122f7fadde666e6b8ea6ebd3
DIFF: https://github.com/llvm/llvm-project/commit/88c2454057b6cd1b122f7fadde666e6b8ea6ebd3.diff
LOG: [InstCombine] Add PR38929 test case
Fold (~x & y) | ~(x | y) --> ~x
Added:
Modified:
llvm/test/Transforms/InstCombine/or.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll
index 22ba395ebe9f..33652f0e1619 100644
--- a/llvm/test/Transforms/InstCombine/or.ll
+++ b/llvm/test/Transforms/InstCombine/or.ll
@@ -4,8 +4,8 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n32:64"
declare void @use(i32)
+; Should be eliminated
define i32 @test12(i32 %A) {
- ; Should be eliminated
; CHECK-LABEL: @test12(
; CHECK-NEXT: [[C:%.*]] = and i32 [[A:%.*]], 8
; CHECK-NEXT: ret i32 [[C]]
@@ -1267,6 +1267,20 @@ end:
ret i32 %conv8
}
+; (~x & y) | ~(x | y) --> ~x
+define i32 @PR38929(i32 %0, i32 %1) {
+; CHECK-LABEL: @PR38929(
+; CHECK-NEXT: [[TMP3:%.*]] = xor i32 [[TMP0:%.*]], -1
+; CHECK-NEXT: ret i32 [[TMP3]]
+;
+ %3 = xor i32 %0, -1
+ %4 = and i32 %3, %1
+ %5 = or i32 %1, %0
+ %6 = xor i32 %5, -1
+ %7 = or i32 %4, %6
+ ret i32 %7
+}
+
define i32 @test1(i32 %x, i32 %y) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[Y:%.*]], [[X:%.*]]
More information about the llvm-commits
mailing list