@@ -2652,8 +2652,7 @@ define <2 x i8> @partial_cond_freeze_constant_true_val_vec(<2 x i8> %x) {
26522652
26532653define <2 x i8 > @partial_cond_freeze_constant_false_val_vec (<2 x i8 > %x ) {
26542654; 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:%.*]]
26572656;
26582657 %cond.fr = freeze <2 x i1 > <i1 true , i1 undef >
26592658 %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) {
26622661
26632662define <2 x i8 > @partial_cond_freeze_both_arms_constant_vec () {
26642663; 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 >
26662665;
26672666 %cond.fr = freeze <2 x i1 > <i1 false , i1 undef >
26682667 %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) {
49044903
49054904define void @select_freeze_poison_parameter (ptr noundef %addr.src , ptr %addr.tgt , i1 %cond ) {
49064905; 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
49094907; CHECK-NEXT: ret void
49104908;
49114909 %freeze = freeze ptr poison
@@ -4914,12 +4912,47 @@ define void @select_freeze_poison_parameter(ptr noundef %addr.src, ptr %addr.tgt
49144912 ret void
49154913}
49164914
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+
49174951@glb = global ptr null
49184952
49194953define void @select_freeze_poison_global (ptr %addr.tgt , i1 %cond ) {
49204954; 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
49234956; CHECK-NEXT: ret void
49244957;
49254958 %freeze = freeze ptr poison
@@ -4930,12 +4963,88 @@ define void @select_freeze_poison_global(ptr %addr.tgt, i1 %cond) {
49304963
49314964define void @select_freeze_poison_constant (ptr %addr.tgt , i1 %cond ) {
49324965; 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
49354967; CHECK-NEXT: ret void
49364968;
49374969 %freeze = freeze i32 poison
49384970 %select.addr = select i1 %cond , i32 72 , i32 %freeze
49394971 store i32 %select.addr , ptr %addr.tgt
49404972 ret void
49414973}
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+ }
5027+
5028+ define <2 x i8 > @select_freeze_constant_expression_vector_add (i1 %cond , <2 x i8 > noundef %y ) {
5029+ ; CHECK-LABEL: @select_freeze_constant_expression_vector_add(
5030+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], <2 x i8> [[Y:%.*]], <2 x i8> splat (i8 3)
5031+ ; CHECK-NEXT: ret <2 x i8> [[SEL]]
5032+ ;
5033+ %freeze = freeze <2 x i8 > <i8 poison, i8 add (i8 1 , i8 2 )>
5034+ %sel = select i1 %cond , <2 x i8 > %y , <2 x i8 > %freeze
5035+ ret <2 x i8 > %sel
5036+ }
5037+
5038+ %struct.1 = type {i32 , i32 }
5039+ @glb.struct.1 = global %struct.1 {i32 1 , i32 2 }
5040+
5041+ define <2 x ptr > @select_freeze_constant_expression_vector_gep (i1 %cond , <2 x ptr > noundef %y ) {
5042+ ; CHECK-LABEL: @select_freeze_constant_expression_vector_gep(
5043+ ; CHECK-NEXT: [[FREEZE:%.*]] = freeze <2 x ptr> <ptr poison, ptr getelementptr inbounds nuw (i8, ptr @glb.struct.1, i64 4)>
5044+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], <2 x ptr> [[Y:%.*]], <2 x ptr> [[FREEZE]]
5045+ ; CHECK-NEXT: ret <2 x ptr> [[SEL]]
5046+ ;
5047+ %freeze = freeze <2 x ptr > <ptr poison, ptr getelementptr (%struct.1 , ptr @glb.struct.1 , i64 0 , i32 1 )>
5048+ %sel = select i1 %cond , <2 x ptr > %y , <2 x ptr > %freeze
5049+ ret <2 x ptr > %sel
5050+ }
0 commit comments