[llvm] 5f9b4bc - [InstCombine] Fix commuted tests (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 29 03:13:11 PDT 2023
Author: Nikita Popov
Date: 2023-08-29T12:13:03+02:00
New Revision: 5f9b4bc293c26d93c9115c5fbe99ddc4e5fab6da
URL: https://github.com/llvm/llvm-project/commit/5f9b4bc293c26d93c9115c5fbe99ddc4e5fab6da
DIFF: https://github.com/llvm/llvm-project/commit/5f9b4bc293c26d93c9115c5fbe99ddc4e5fab6da.diff
LOG: [InstCombine] Fix commuted tests (NFC)
Make sure complexity-based canonicalization doesn't get in the
way.
Added:
Modified:
llvm/test/Transforms/InstCombine/select-and-or.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/select-and-or.ll b/llvm/test/Transforms/InstCombine/select-and-or.ll
index 66d67b57697ec0..275268cd9bd047 100644
--- a/llvm/test/Transforms/InstCombine/select-and-or.ll
+++ b/llvm/test/Transforms/InstCombine/select-and-or.ll
@@ -628,26 +628,30 @@ define i1 @or_and2(i1 %a, i1 %b, i1 %c) {
ret i1 %r
}
-define i1 @or_and1_commuted(i1 %a, i1 %b, i1 %c) {
+define i1 @or_and1_commuted(i1 %a, i1 %b) {
; CHECK-LABEL: @or_and1_commuted(
+; CHECK-NEXT: [[C:%.*]] = call i1 @gen_i1()
; CHECK-NEXT: [[NOTB:%.*]] = xor i1 [[B:%.*]], true
-; CHECK-NEXT: [[COND:%.*]] = and i1 [[NOTB]], [[C:%.*]]
+; CHECK-NEXT: [[COND:%.*]] = and i1 [[C]], [[NOTB]]
; CHECK-NEXT: [[R:%.*]] = select i1 [[COND]], i1 [[A:%.*]], i1 [[B]]
; CHECK-NEXT: ret i1 [[R]]
;
+ %c = call i1 @gen_i1()
%notb = xor i1 %b, true
%cond = and i1 %c, %notb
%r = select i1 %cond, i1 %a, i1 %b
ret i1 %r
}
-define i1 @or_and2_commuted(i1 %a, i1 %b, i1 %c) {
+define i1 @or_and2_commuted(i1 %b, i1 %c) {
; CHECK-LABEL: @or_and2_commuted(
+; CHECK-NEXT: [[A:%.*]] = call i1 @gen_i1()
; CHECK-NEXT: [[NOTC:%.*]] = xor i1 [[C:%.*]], true
-; CHECK-NEXT: [[COND:%.*]] = or i1 [[NOTC]], [[A:%.*]]
+; CHECK-NEXT: [[COND:%.*]] = or i1 [[A]], [[NOTC]]
; CHECK-NEXT: [[R:%.*]] = select i1 [[COND]], i1 [[A]], i1 [[B:%.*]]
; CHECK-NEXT: ret i1 [[R]]
;
+ %a = call i1 @gen_i1()
%notc = xor i1 %c, true
%cond = or i1 %a, %notc
%r = select i1 %cond, i1 %a, i1 %b
@@ -684,32 +688,28 @@ define i1 @or_and2_multiuse(i1 %a, i1 %b, i1 %c) {
ret i1 %r
}
-define <2 x i1> @or_and1_vec(<2 x i1> %a, <2 x i1> %b) {
+define <2 x i1> @or_and1_vec(<2 x i1> %a, <2 x i1> %b, <2 x i1> %c) {
; CHECK-LABEL: @or_and1_vec(
-; CHECK-NEXT: [[C:%.*]] = call <2 x i1> @gen_v2i1()
; CHECK-NEXT: [[NOTB:%.*]] = xor <2 x i1> [[B:%.*]], <i1 true, i1 true>
-; CHECK-NEXT: [[COND:%.*]] = and <2 x i1> [[C]], [[NOTB]]
+; CHECK-NEXT: [[COND:%.*]] = and <2 x i1> [[NOTB]], [[C:%.*]]
; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[COND]], <2 x i1> [[A:%.*]], <2 x i1> [[B]]
; CHECK-NEXT: ret <2 x i1> [[R]]
;
- %c = call <2 x i1> @gen_v2i1()
%notb = xor <2 x i1> %b, <i1 true, i1 true>
- %cond = and <2 x i1> %c, %notb
+ %cond = and <2 x i1> %notb, %c
%r = select <2 x i1> %cond, <2 x i1> %a, <2 x i1> %b
ret <2 x i1> %r
}
-define <2 x i1> @or_and2_vec(<2 x i1> %a, <2 x i1> %b) {
+define <2 x i1> @or_and2_vec(<2 x i1> %a, <2 x i1> %b, <2 x i1> %c) {
; CHECK-LABEL: @or_and2_vec(
-; CHECK-NEXT: [[C:%.*]] = call <2 x i1> @gen_v2i1()
-; CHECK-NEXT: [[NOTC:%.*]] = xor <2 x i1> [[C]], <i1 true, i1 true>
+; CHECK-NEXT: [[NOTC:%.*]] = xor <2 x i1> [[C:%.*]], <i1 true, i1 true>
; CHECK-NEXT: [[COND:%.*]] = or <2 x i1> [[NOTC]], [[A:%.*]]
; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[COND]], <2 x i1> [[A]], <2 x i1> [[B:%.*]]
; CHECK-NEXT: ret <2 x i1> [[R]]
;
- %c = call <2 x i1> @gen_v2i1()
%notc = xor <2 x i1> %c, <i1 true, i1 true>
- %cond = or <2 x i1> %a, %notc
+ %cond = or <2 x i1> %notc, %a
%r = select <2 x i1> %cond, <2 x i1> %a, <2 x i1> %b
ret <2 x i1> %r
}
@@ -724,22 +724,22 @@ define <2 x i1> @or_and1_vec_commuted(<2 x i1> %a, <2 x i1> %b) {
;
%c = call <2 x i1> @gen_v2i1()
%notb = xor <2 x i1> %b, <i1 true, i1 true>
- %cond = and <2 x i1> %notb, %c
+ %cond = and <2 x i1> %c, %notb
%r = select <2 x i1> %cond, <2 x i1> %a, <2 x i1> %b
ret <2 x i1> %r
}
-define <2 x i1> @or_and2_vec_commuted(<2 x i1> %a, <2 x i1> %b) {
+define <2 x i1> @or_and2_vec_commuted(<2 x i1> %b, <2 x i1> %c) {
; CHECK-LABEL: @or_and2_vec_commuted(
-; CHECK-NEXT: [[C:%.*]] = call <2 x i1> @gen_v2i1()
-; CHECK-NEXT: [[NOTC:%.*]] = xor <2 x i1> [[C]], <i1 true, i1 true>
-; CHECK-NEXT: [[COND:%.*]] = or <2 x i1> [[NOTC]], [[A:%.*]]
+; CHECK-NEXT: [[A:%.*]] = call <2 x i1> @gen_v2i1()
+; CHECK-NEXT: [[NOTC:%.*]] = xor <2 x i1> [[C:%.*]], <i1 true, i1 true>
+; CHECK-NEXT: [[COND:%.*]] = or <2 x i1> [[A]], [[NOTC]]
; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[COND]], <2 x i1> [[A]], <2 x i1> [[B:%.*]]
; CHECK-NEXT: ret <2 x i1> [[R]]
;
- %c = call <2 x i1> @gen_v2i1()
+ %a = call <2 x i1> @gen_v2i1()
%notc = xor <2 x i1> %c, <i1 true, i1 true>
- %cond = or <2 x i1> %notc, %a
+ %cond = or <2 x i1> %a, %notc
%r = select <2 x i1> %cond, <2 x i1> %a, <2 x i1> %b
ret <2 x i1> %r
}
More information about the llvm-commits
mailing list