@@ -2652,8 +2652,7 @@ define <2 x i8> @partial_cond_freeze_constant_true_val_vec(<2 x i8> %x) {
2652
2652
2653
2653
define <2 x i8 > @partial_cond_freeze_constant_false_val_vec (<2 x i8 > %x ) {
2654
2654
; CHECK-LABEL: @partial_cond_freeze_constant_false_val_vec(
2655
- ; CHECK-NEXT: [[S1:%.*]] = insertelement <2 x i8> [[X:%.*]], i8 2, i64 1
2656
- ; CHECK-NEXT: ret <2 x i8> [[S1]]
2655
+ ; CHECK-NEXT: ret <2 x i8> [[X:%.*]]
2657
2656
;
2658
2657
%cond.fr = freeze <2 x i1 > <i1 true , i1 undef >
2659
2658
%s = select <2 x i1 > %cond.fr , <2 x i8 > %x , <2 x i8 > <i8 1 , i8 2 >
@@ -2662,7 +2661,7 @@ define <2 x i8> @partial_cond_freeze_constant_false_val_vec(<2 x i8> %x) {
2662
2661
2663
2662
define <2 x i8 > @partial_cond_freeze_both_arms_constant_vec () {
2664
2663
; CHECK-LABEL: @partial_cond_freeze_both_arms_constant_vec(
2665
- ; CHECK-NEXT: ret <2 x i8> <i8 42, i8 2 >
2664
+ ; CHECK-NEXT: ret <2 x i8> <i8 42, i8 43 >
2666
2665
;
2667
2666
%cond.fr = freeze <2 x i1 > <i1 false , i1 undef >
2668
2667
%s = select <2 x i1 > %cond.fr , <2 x i8 > <i8 1 , i8 2 >, <2 x i8 > <i8 42 , i8 43 >
@@ -4904,8 +4903,7 @@ define i32 @src_simplify_2x_at_once_and(i32 %x, i32 %y) {
4904
4903
4905
4904
define void @select_freeze_poison_parameter (ptr noundef %addr.src , ptr %addr.tgt , i1 %cond ) {
4906
4905
; CHECK-LABEL: @select_freeze_poison_parameter(
4907
- ; CHECK-NEXT: [[ADDR_SRC:%.*]] = select i1 [[COND:%.*]], ptr [[ADDR_SRC1:%.*]], ptr null
4908
- ; CHECK-NEXT: store ptr [[ADDR_SRC]], ptr [[ADDR_TGT:%.*]], align 8
4906
+ ; CHECK-NEXT: store ptr [[ADDR_SRC:%.*]], ptr [[ADDR_TGT:%.*]], align 8
4909
4907
; CHECK-NEXT: ret void
4910
4908
;
4911
4909
%freeze = freeze ptr poison
@@ -4914,12 +4912,47 @@ define void @select_freeze_poison_parameter(ptr noundef %addr.src, ptr %addr.tgt
4914
4912
ret void
4915
4913
}
4916
4914
4915
+ define i8 @select_freeze_poison_different_parameters (i8 noundef %x , i8 noundef %y , i1 %cond1 , i1 %cond2 ) {
4916
+ ; CHECK-LABEL: @select_freeze_poison_different_parameters(
4917
+ ; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[COND1:%.*]], i8 [[X:%.*]], i8 0
4918
+ ; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[COND2:%.*]], i8 [[Y:%.*]], i8 0
4919
+ ; CHECK-NEXT: [[CONJ:%.*]] = and i8 [[SEL1]], [[SEL2]]
4920
+ ; CHECK-NEXT: ret i8 [[CONJ]]
4921
+ ;
4922
+ %freeze = freeze i8 poison
4923
+ %sel1 = select i1 %cond1 , i8 %x , i8 %freeze
4924
+ %sel2 = select i1 %cond2 , i8 %y , i8 %freeze
4925
+ %conj = and i8 %sel1 , %sel2
4926
+ ret i8 %conj
4927
+ }
4928
+
4929
+ define i8 @select_or_freeze_poison_parameter (i8 noundef %x , i1 %cond1 ) {
4930
+ ; CHECK-LABEL: @select_or_freeze_poison_parameter(
4931
+ ; CHECK-NEXT: ret i8 -1
4932
+ ;
4933
+ %freeze = freeze i8 poison
4934
+ %sel1 = select i1 %cond1 , i8 -1 , i8 %freeze
4935
+ %or1 = or i8 %x , %freeze
4936
+ %conj = and i8 %sel1 , %or1
4937
+ ret i8 %conj
4938
+ }
4939
+
4940
+ define i8 @selects_freeze_poison_parameter (i8 noundef %x , i1 %cond1 , i1 %cond2 ) {
4941
+ ; CHECK-LABEL: @selects_freeze_poison_parameter(
4942
+ ; CHECK-NEXT: ret i8 [[X:%.*]]
4943
+ ;
4944
+ %freeze = freeze i8 poison
4945
+ %sel1 = select i1 %cond1 , i8 %x , i8 %freeze
4946
+ %sel2 = select i1 %cond2 , i8 %x , i8 %freeze
4947
+ %conj = and i8 %sel1 , %sel2
4948
+ ret i8 %conj
4949
+ }
4950
+
4917
4951
@glb = global ptr null
4918
4952
4919
4953
define void @select_freeze_poison_global (ptr %addr.tgt , i1 %cond ) {
4920
4954
; CHECK-LABEL: @select_freeze_poison_global(
4921
- ; CHECK-NEXT: [[SELECT_ADDR:%.*]] = select i1 [[COND:%.*]], ptr @glb, ptr null
4922
- ; CHECK-NEXT: store ptr [[SELECT_ADDR]], ptr [[ADDR_TGT:%.*]], align 8
4955
+ ; CHECK-NEXT: store ptr @glb, ptr [[ADDR_TGT:%.*]], align 8
4923
4956
; CHECK-NEXT: ret void
4924
4957
;
4925
4958
%freeze = freeze ptr poison
@@ -4930,12 +4963,64 @@ define void @select_freeze_poison_global(ptr %addr.tgt, i1 %cond) {
4930
4963
4931
4964
define void @select_freeze_poison_constant (ptr %addr.tgt , i1 %cond ) {
4932
4965
; CHECK-LABEL: @select_freeze_poison_constant(
4933
- ; CHECK-NEXT: [[SELECT_ADDR:%.*]] = select i1 [[COND:%.*]], i32 72, i32 0
4934
- ; CHECK-NEXT: store i32 [[SELECT_ADDR]], ptr [[ADDR_TGT:%.*]], align 4
4966
+ ; CHECK-NEXT: store i32 72, ptr [[ADDR_TGT:%.*]], align 4
4935
4967
; CHECK-NEXT: ret void
4936
4968
;
4937
4969
%freeze = freeze i32 poison
4938
4970
%select.addr = select i1 %cond , i32 72 , i32 %freeze
4939
4971
store i32 %select.addr , ptr %addr.tgt
4940
4972
ret void
4941
4973
}
4974
+
4975
+ define <2 x i8 > @select_freeze_poison_mask_vector (i1 %cond , <2 x i8 > noundef %y ) {
4976
+ ; CHECK-LABEL: @select_freeze_poison_mask_vector(
4977
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], <2 x i8> [[Y:%.*]], <2 x i8> zeroinitializer
4978
+ ; CHECK-NEXT: ret <2 x i8> [[SEL]]
4979
+ ;
4980
+ %freeze = freeze <2 x i8 > <i8 0 , i8 poison>
4981
+ %sel = select i1 %cond , <2 x i8 > %y , <2 x i8 > %freeze
4982
+ ret <2 x i8 > %sel
4983
+ }
4984
+
4985
+ define <2 x i8 > @selects_freeze_poison_mask_vector (<2 x i8 > noundef %x , i1 %cond1 , i1 %cond2 ) {
4986
+ ; CHECK-LABEL: @selects_freeze_poison_mask_vector(
4987
+ ; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[COND1:%.*]], i1 [[COND2:%.*]], i1 false
4988
+ ; CHECK-NEXT: [[X:%.*]] = select i1 [[TMP1]], <2 x i8> [[X1:%.*]], <2 x i8> zeroinitializer
4989
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
4990
+ ;
4991
+ %freeze = freeze <2 x i8 > <i8 0 , i8 poison>
4992
+ %sel1 = select i1 %cond1 , <2 x i8 > %x , <2 x i8 > %freeze
4993
+ %sel2 = select i1 %cond2 , <2 x i8 > %x , <2 x i8 > %freeze
4994
+ %conj = and <2 x i8 > %sel1 , %sel2
4995
+ ret <2 x i8 > %conj
4996
+ }
4997
+
4998
+ define <2 x i8 > @select_freeze_poison_splat_vector (i1 %cond , <2 x i8 > noundef %y ) {
4999
+ ; CHECK-LABEL: @select_freeze_poison_splat_vector(
5000
+ ; CHECK-NEXT: ret <2 x i8> [[Y:%.*]]
5001
+ ;
5002
+ %freeze = freeze <2 x i8 > <i8 poison, i8 poison>
5003
+ %sel = select i1 %cond , <2 x i8 > %y , <2 x i8 > %freeze
5004
+ ret <2 x i8 > %sel
5005
+ }
5006
+
5007
+ define <2 x i8 > @selects_freeze_poison_splat_vector (<2 x i8 > noundef %x , i1 %cond1 , i1 %cond2 ) {
5008
+ ; CHECK-LABEL: @selects_freeze_poison_splat_vector(
5009
+ ; CHECK-NEXT: ret <2 x i8> [[X:%.*]]
5010
+ ;
5011
+ %freeze = freeze <2 x i8 > <i8 poison, i8 poison>
5012
+ %sel1 = select i1 %cond1 , <2 x i8 > %x , <2 x i8 > %freeze
5013
+ %sel2 = select i1 %cond2 , <2 x i8 > %x , <2 x i8 > %freeze
5014
+ %conj = and <2 x i8 > %sel1 , %sel2
5015
+ ret <2 x i8 > %conj
5016
+ }
5017
+
5018
+ define <2 x i8 > @select_freeze_constant_vector (i1 %cond , <2 x i8 > noundef %y ) {
5019
+ ; CHECK-LABEL: @select_freeze_constant_vector(
5020
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], <2 x i8> [[Y:%.*]], <2 x i8> zeroinitializer
5021
+ ; CHECK-NEXT: ret <2 x i8> [[SEL]]
5022
+ ;
5023
+ %freeze = freeze <2 x i8 > <i8 0 , i8 0 >
5024
+ %sel = select i1 %cond , <2 x i8 > %y , <2 x i8 > %freeze
5025
+ ret <2 x i8 > %sel
5026
+ }
0 commit comments