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:%.*]], -; 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, - %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]], +; CHECK-NEXT: [[NOTC:%.*]] = xor <2 x i1> [[C:%.*]], ; 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, - %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, - %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]], -; 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:%.*]], +; 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, - %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 }