@@ -55,6 +55,7 @@ define i8 @test_early_exit_max_tc_less_than_16(ptr dereferenceable(16) %A) nosyn
5555; VF8UF2: [[VECTOR_PH]]:
5656; VF8UF2-NEXT: br label %[[VECTOR_BODY:.*]]
5757; VF8UF2: [[VECTOR_BODY]]:
58+ ; VF8UF2-NEXT: [[P_SRC:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 0
5859; VF8UF2-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[P_SRC]], i32 0
5960; VF8UF2-NEXT: [[WIDE_LOAD:%.*]] = load <8 x i8>, ptr [[TMP2]], align 1
6061; VF8UF2-NEXT: [[TMP3:%.*]] = icmp eq <8 x i8> [[WIDE_LOAD]], zeroinitializer
@@ -90,6 +91,7 @@ define i8 @test_early_exit_max_tc_less_than_16(ptr dereferenceable(16) %A) nosyn
9091; VF16UF1: [[VECTOR_PH]]:
9192; VF16UF1-NEXT: br label %[[VECTOR_BODY:.*]]
9293; VF16UF1: [[VECTOR_BODY]]:
94+ ; VF16UF1-NEXT: [[P_SRC:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 0
9395; VF16UF1-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[P_SRC]], i32 0
9496; VF16UF1-NEXT: [[WIDE_LOAD:%.*]] = load <16 x i8>, ptr [[TMP2]], align 1
9597; VF16UF1-NEXT: [[TMP3:%.*]] = icmp eq <16 x i8> [[WIDE_LOAD]], zeroinitializer
@@ -188,19 +190,19 @@ define i64 @test_early_exit_max_tc_less_than_16_with_iv_used_outside(ptr derefer
188190; VF8UF2: [[VECTOR_PH]]:
189191; VF8UF2-NEXT: br label %[[VECTOR_BODY:.*]]
190192; VF8UF2: [[VECTOR_BODY]]:
191- ; VF8UF2-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
192- ; VF8UF2-NEXT: [[P_SRC:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 [[INDEX]]
193+ ; VF8UF2-NEXT: [[P_SRC:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 0
193194; VF8UF2-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[P_SRC]], i32 0
194195; VF8UF2-NEXT: [[WIDE_LOAD:%.*]] = load <8 x i8>, ptr [[TMP2]], align 1
195196; VF8UF2-NEXT: [[TMP3:%.*]] = icmp eq <8 x i8> [[WIDE_LOAD]], zeroinitializer
196- ; VF8UF2-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16
197+ ; VF8UF2-NEXT: [[TMP4:%.*]] = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> [[TMP3]])
198+ ; VF8UF2-NEXT: br label %[[MIDDLE_SPLIT:.*]]
197199; VF8UF2: [[MIDDLE_SPLIT]]:
198200; VF8UF2-NEXT: br i1 [[TMP4]], label %[[VECTOR_EARLY_EXIT:.*]], label %[[MIDDLE_BLOCK:.*]]
199201; VF8UF2: [[MIDDLE_BLOCK]]:
200202; VF8UF2-NEXT: br i1 true, label %[[EXIT:.*]], label %[[SCALAR_PH]]
201203; VF8UF2: [[VECTOR_EARLY_EXIT]]:
202204; VF8UF2-NEXT: [[FIRST_ACTIVE_LANE:%.*]] = call i64 @llvm.experimental.cttz.elts.i64.v8i1(<8 x i1> [[TMP3]], i1 true)
203- ; VF8UF2-NEXT: [[TMP8 :%.*]] = add i64 [[INDEX]] , [[FIRST_ACTIVE_LANE]]
205+ ; VF8UF2-NEXT: [[TMP5 :%.*]] = add i64 0 , [[FIRST_ACTIVE_LANE]]
204206; VF8UF2-NEXT: br label %[[EXIT]]
205207; VF8UF2: [[SCALAR_PH]]:
206208; VF8UF2-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 16, %[[MIDDLE_BLOCK]] ], [ 0, %[[ENTRY]] ]
@@ -214,9 +216,9 @@ define i64 @test_early_exit_max_tc_less_than_16_with_iv_used_outside(ptr derefer
214216; VF8UF2: [[LOOP_LATCH]]:
215217; VF8UF2-NEXT: [[IV_NEXT]] = add nsw i64 [[IV1]], 1
216218; VF8UF2-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], 16
217- ; VF8UF2-NEXT: br i1 [[CMP]], label %[[EXIT]], label %[[LOOP_HEADER]], !llvm.loop [[LOOP4 :![0-9]+]]
219+ ; VF8UF2-NEXT: br i1 [[CMP]], label %[[EXIT]], label %[[LOOP_HEADER]], !llvm.loop [[LOOP3 :![0-9]+]]
218220; VF8UF2: [[EXIT]]:
219- ; VF8UF2-NEXT: [[RES:%.*]] = phi i64 [ [[IV1]], %[[LOOP_HEADER]] ], [ 1, %[[LOOP_LATCH]] ], [ 1, %[[MIDDLE_BLOCK]] ], [ [[TMP8 ]], %[[VECTOR_EARLY_EXIT]] ]
221+ ; VF8UF2-NEXT: [[RES:%.*]] = phi i64 [ [[IV1]], %[[LOOP_HEADER]] ], [ 1, %[[LOOP_LATCH]] ], [ 1, %[[MIDDLE_BLOCK]] ], [ [[TMP5 ]], %[[VECTOR_EARLY_EXIT]] ]
220222; VF8UF2-NEXT: ret i64 [[RES]]
221223;
222224; VF16UF1-LABEL: define i64 @test_early_exit_max_tc_less_than_16_with_iv_used_outside(
@@ -226,19 +228,19 @@ define i64 @test_early_exit_max_tc_less_than_16_with_iv_used_outside(ptr derefer
226228; VF16UF1: [[VECTOR_PH]]:
227229; VF16UF1-NEXT: br label %[[VECTOR_BODY:.*]]
228230; VF16UF1: [[VECTOR_BODY]]:
229- ; VF16UF1-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
230- ; VF16UF1-NEXT: [[P_SRC:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 [[INDEX]]
231+ ; VF16UF1-NEXT: [[P_SRC:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 0
231232; VF16UF1-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[P_SRC]], i32 0
232233; VF16UF1-NEXT: [[WIDE_LOAD:%.*]] = load <16 x i8>, ptr [[TMP2]], align 1
233234; VF16UF1-NEXT: [[TMP3:%.*]] = icmp eq <16 x i8> [[WIDE_LOAD]], zeroinitializer
234- ; VF16UF1-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16
235+ ; VF16UF1-NEXT: [[TMP4:%.*]] = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> [[TMP3]])
236+ ; VF16UF1-NEXT: br label %[[MIDDLE_SPLIT:.*]]
235237; VF16UF1: [[MIDDLE_SPLIT]]:
236238; VF16UF1-NEXT: br i1 [[TMP4]], label %[[VECTOR_EARLY_EXIT:.*]], label %[[MIDDLE_BLOCK:.*]]
237239; VF16UF1: [[MIDDLE_BLOCK]]:
238240; VF16UF1-NEXT: br i1 true, label %[[EXIT:.*]], label %[[SCALAR_PH]]
239241; VF16UF1: [[VECTOR_EARLY_EXIT]]:
240242; VF16UF1-NEXT: [[FIRST_ACTIVE_LANE:%.*]] = call i64 @llvm.experimental.cttz.elts.i64.v16i1(<16 x i1> [[TMP3]], i1 true)
241- ; VF16UF1-NEXT: [[TMP8 :%.*]] = add i64 [[INDEX]] , [[FIRST_ACTIVE_LANE]]
243+ ; VF16UF1-NEXT: [[TMP5 :%.*]] = add i64 0 , [[FIRST_ACTIVE_LANE]]
242244; VF16UF1-NEXT: br label %[[EXIT]]
243245; VF16UF1: [[SCALAR_PH]]:
244246; VF16UF1-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 16, %[[MIDDLE_BLOCK]] ], [ 0, %[[ENTRY]] ]
@@ -252,9 +254,9 @@ define i64 @test_early_exit_max_tc_less_than_16_with_iv_used_outside(ptr derefer
252254; VF16UF1: [[LOOP_LATCH]]:
253255; VF16UF1-NEXT: [[IV_NEXT]] = add nsw i64 [[IV1]], 1
254256; VF16UF1-NEXT: [[CMP:%.*]] = icmp eq i64 [[IV_NEXT]], 16
255- ; VF16UF1-NEXT: br i1 [[CMP]], label %[[EXIT]], label %[[LOOP_HEADER]], !llvm.loop [[LOOP4 :![0-9]+]]
257+ ; VF16UF1-NEXT: br i1 [[CMP]], label %[[EXIT]], label %[[LOOP_HEADER]], !llvm.loop [[LOOP3 :![0-9]+]]
256258; VF16UF1: [[EXIT]]:
257- ; VF16UF1-NEXT: [[RES:%.*]] = phi i64 [ [[IV1]], %[[LOOP_HEADER]] ], [ 1, %[[LOOP_LATCH]] ], [ 1, %[[MIDDLE_BLOCK]] ], [ [[TMP8 ]], %[[VECTOR_EARLY_EXIT]] ]
259+ ; VF16UF1-NEXT: [[RES:%.*]] = phi i64 [ [[IV1]], %[[LOOP_HEADER]] ], [ 1, %[[LOOP_LATCH]] ], [ 1, %[[MIDDLE_BLOCK]] ], [ [[TMP5 ]], %[[VECTOR_EARLY_EXIT]] ]
258260; VF16UF1-NEXT: ret i64 [[RES]]
259261;
260262entry:
0 commit comments