Skip to content

Commit e19d815

Browse files
committed
[LV][NFC] Remove remaining uses of undef in tests
Split off from PR #163525, this standalone patch replaces almost all the remaining cases where undef is used as value in loop vectoriser tests. This will reduce the likelihood of contributors hitting the `undef deprecator` warning in github. NOTE: The remaining use of undef in iv_outside_user.ll will be fixed in a separate PR. I've removed the test stride_undef from version-mem-access.ll, since there is already a stride_poison test.
1 parent e575539 commit e19d815

File tree

10 files changed

+59
-90
lines changed

10 files changed

+59
-90
lines changed

llvm/test/Transforms/LoopVectorize/X86/pr39160.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bb:
1313
br label %bb2
1414

1515
bb2: ; preds = %bb2, %bb
16-
%tmp4 = icmp slt i32 undef, 0
16+
%tmp4 = icmp slt i32 poison, 0
1717
br i1 %tmp4, label %bb2, label %bb5
1818

1919
bb5: ; preds = %bb2
@@ -23,8 +23,8 @@ bb18: ; preds = %bb33
2323
ret void
2424

2525
bb19: ; preds = %bb36, %bb5
26-
%tmp21 = phi i64 [ undef, %bb36 ], [ 2, %bb5 ]
27-
%tmp22 = phi i32 [ %tmp65, %bb36 ], [ undef, %bb5 ]
26+
%tmp21 = phi i64 [ poison, %bb36 ], [ 2, %bb5 ]
27+
%tmp22 = phi i32 [ %tmp65, %bb36 ], [ poison, %bb5 ]
2828
br label %bb50
2929

3030
bb33: ; preds = %bb62
@@ -48,7 +48,7 @@ bb50: ; preds = %bb50, %bb19
4848
%tmp54 = add i32 %tmp52, 12
4949
%tmp55 = add i32 %tmp52, 13
5050
%tmp56 = add nuw nsw i64 %tmp53, 1
51-
%tmp58 = icmp ult i64 %tmp53, undef
51+
%tmp58 = icmp ult i64 %tmp53, poison
5252
br i1 %tmp58, label %bb50, label %bb46
5353

5454
bb59: ; preds = %bb46

llvm/test/Transforms/LoopVectorize/if-conversion.ll

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,22 +237,36 @@ for.end: ; preds = %for.inc, %entry
237237
; Handle PHI with single incoming value having a full mask.
238238
; PR34523
239239

240-
; NOTE: Changing PHI inputs from undef to poison leads to change in
241-
; behaviour of the test. Left as undef for now.
242-
define void @PR34523() {
243-
; CHECK-LABEL: define void @PR34523() {
244-
; CHECK-NEXT: [[BB1:.*:]]
245-
; CHECK-NEXT: br i1 true, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
240+
define void @PR34523(ptr %p, i16 %val) {
241+
; CHECK-LABEL: define void @PR34523(
242+
; CHECK-SAME: ptr [[P:%.*]], i16 [[VAL:%.*]]) {
243+
; CHECK-NEXT: [[BB1:.*]]:
244+
; CHECK-NEXT: [[TMP0:%.*]] = add i16 [[VAL]], 1
245+
; CHECK-NEXT: [[SMAX:%.*]] = call i16 @llvm.smax.i16(i16 [[TMP0]], i16 2)
246+
; CHECK-NEXT: [[TMP1:%.*]] = xor i16 [[VAL]], -1
247+
; CHECK-NEXT: [[TMP2:%.*]] = add i16 [[SMAX]], [[TMP1]]
248+
; CHECK-NEXT: [[TMP3:%.*]] = zext i16 [[TMP2]] to i32
249+
; CHECK-NEXT: [[TMP4:%.*]] = add nuw nsw i32 [[TMP3]], 1
250+
; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i16 [[TMP2]], 3
251+
; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
246252
; CHECK: [[VECTOR_PH]]:
253+
; CHECK-NEXT: [[N_VEC:%.*]] = and i32 [[TMP4]], 131068
254+
; CHECK-NEXT: [[DOTCAST:%.*]] = trunc i32 [[N_VEC]] to i16
255+
; CHECK-NEXT: [[TMP5:%.*]] = add i16 [[VAL]], [[DOTCAST]]
247256
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
248257
; CHECK: [[VECTOR_BODY]]:
249-
; CHECK-NEXT: br i1 poison, label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP11:![0-9]+]]
258+
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
259+
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 4
260+
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
261+
; CHECK-NEXT: br i1 [[TMP6]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP11:![0-9]+]]
250262
; CHECK: [[MIDDLE_BLOCK]]:
251-
; CHECK-NEXT: br i1 poison, label %[[BB5:.*]], label %[[SCALAR_PH]]
263+
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP4]], [[N_VEC]]
264+
; CHECK-NEXT: br i1 [[CMP_N]], label %[[BB5:.*]], label %[[SCALAR_PH]]
252265
; CHECK: [[SCALAR_PH]]:
266+
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i16 [ [[TMP5]], %[[MIDDLE_BLOCK]] ], [ [[VAL]], %[[BB1]] ]
253267
; CHECK-NEXT: br label %[[BB2:.*]]
254268
; CHECK: [[BB2]]:
255-
; CHECK-NEXT: [[I:%.*]] = phi i16 [ undef, %[[SCALAR_PH]] ], [ [[_TMP2:%.*]], %[[BB4:.*]] ]
269+
; CHECK-NEXT: [[I:%.*]] = phi i16 [ [[BC_RESUME_VAL]], %[[SCALAR_PH]] ], [ [[_TMP2:%.*]], %[[BB4:.*]] ]
256270
; CHECK-NEXT: br label %[[BB3:.*]]
257271
; CHECK: [[BB3]]:
258272
; CHECK-NEXT: br label %[[BB4]]
@@ -267,11 +281,11 @@ bb1:
267281
br label %bb2
268282

269283
bb2: ; preds = %bb4, %bb1
270-
%i = phi i16 [ undef, %bb1 ], [ %_tmp2, %bb4 ]
284+
%i = phi i16 [ %val, %bb1 ], [ %_tmp2, %bb4 ]
271285
br label %bb3
272286

273287
bb3: ; preds = %bb2
274-
%_tmp1 = phi ptr [ undef, %bb2 ]
288+
%_tmp1 = phi ptr [ %p, %bb2 ]
275289
br label %bb4
276290

277291
bb4: ; preds = %bb3

llvm/test/Transforms/LoopVectorize/incorrect-dom-info.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ thread-pre-split.loopexit: ; preds = %11, %.thread-pre-sp
5858
br i1 %arg, label %11, label %22
5959

6060
; <label>:11 ; preds = %.lr.ph21
61-
%12 = getelementptr inbounds [0 x i8], ptr @PL_utf8skip, i64 0, i64 undef
61+
%12 = getelementptr inbounds [0 x i8], ptr @PL_utf8skip, i64 0, i64 0
6262
%13 = load i8, ptr %12, align 1
6363
%14 = zext i8 %13 to i64
6464
%15 = icmp ugt i64 %14, %10

llvm/test/Transforms/LoopVectorize/iv_outside_user.ll

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,16 @@ for.end:
262262
ret i32 %phi
263263
}
264264

265-
define void @PR30742() {
266-
; CHECK-LABEL: define void @PR30742() {
265+
define void @PR30742(ptr %p) {
266+
; CHECK-LABEL: define void @PR30742(
267+
; CHECK-SAME: ptr [[P:%.*]]) {
267268
; CHECK-NEXT: [[BB0:.*:]]
268269
; CHECK-NEXT: br label %[[BB1:.*]]
269270
; CHECK: [[BB1_LOOPEXIT:.*]]:
270271
; CHECK-NEXT: br label %[[BB1]]
271272
; CHECK: [[BB1]]:
272-
; CHECK-NEXT: [[TMP00:%.*]] = load i32, ptr undef, align 16
273-
; CHECK-NEXT: [[TMP01:%.*]] = sub i32 [[TMP00]], undef
273+
; CHECK-NEXT: [[TMP00:%.*]] = load i32, ptr [[P]], align 16
274+
; CHECK-NEXT: [[TMP01:%.*]] = sub i32 [[TMP00]], 3
274275
; CHECK-NEXT: [[TMP02:%.*]] = icmp slt i32 [[TMP01]], 1
275276
; CHECK-NEXT: [[TMP03:%.*]] = select i1 [[TMP02]], i32 1, i32 [[TMP01]]
276277
; CHECK-NEXT: [[TMP04:%.*]] = add nsw i32 [[TMP03]], -7
@@ -307,7 +308,7 @@ define void @PR30742() {
307308
; CHECK-NEXT: br i1 [[TMP07]], label %[[BB2]], label %[[BB3]], {{!llvm.loop ![0-9]+}}
308309
; CHECK: [[BB3]]:
309310
; CHECK-NEXT: [[TMP08:%.*]] = phi i32 [ [[TMP05]], %[[BB2]] ], [ [[IND_ESCAPE]], %[[MIDDLE_BLOCK10]] ]
310-
; CHECK-NEXT: [[TMP09:%.*]] = sub i32 [[TMP00]], undef
311+
; CHECK-NEXT: [[TMP09:%.*]] = sub i32 [[TMP00]], 4
311312
; CHECK-NEXT: [[TMP10:%.*]] = icmp slt i32 [[TMP09]], 1
312313
; CHECK-NEXT: [[TMP11:%.*]] = select i1 [[TMP10]], i32 1, i32 [[TMP09]]
313314
; CHECK-NEXT: [[TMP12:%.*]] = add nsw i32 [[TMP11]], -7
@@ -346,8 +347,8 @@ BB0:
346347
br label %BB1
347348

348349
BB1:
349-
%tmp00 = load i32, ptr undef, align 16
350-
%tmp01 = sub i32 %tmp00, undef
350+
%tmp00 = load i32, ptr %p, align 16
351+
%tmp01 = sub i32 %tmp00, 3
351352
%tmp02 = icmp slt i32 %tmp01, 1
352353
%tmp03 = select i1 %tmp02, i32 1, i32 %tmp01
353354
%tmp04 = add nsw i32 %tmp03, -7
@@ -361,7 +362,7 @@ BB2:
361362

362363
BB3:
363364
%tmp08 = phi i32 [ %tmp05, %BB2 ]
364-
%tmp09 = sub i32 %tmp00, undef
365+
%tmp09 = sub i32 %tmp00, 4
365366
%tmp10 = icmp slt i32 %tmp09, 1
366367
%tmp11 = select i1 %tmp10, i32 1, i32 %tmp09
367368
%tmp11.inc = add nsw i32 %tmp11, -7

llvm/test/Transforms/LoopVectorize/lcssa-crashes.ll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ define void @test() {
77
; CHECK-LABEL: @test(
88
; CHECK-NEXT: br label [[FOR_BODY_LR_PH_I_I_I:%.*]]
99
; CHECK: for.body.lr.ph.i.i.i:
10-
; CHECK-NEXT: br i1 true, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
10+
; CHECK-NEXT: br i1 poison, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
1111
; CHECK: vector.ph:
1212
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
1313
; CHECK: vector.body:
1414
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
1515
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
16-
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i64 [[INDEX_NEXT]], 0
16+
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i64 [[INDEX_NEXT]], poison
1717
; CHECK-NEXT: br i1 [[TMP1]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
1818
; CHECK: middle.block:
19-
; CHECK-NEXT: br i1 false, label [[FOR_END_I_I_I:%.*]], label [[SCALAR_PH]]
19+
; CHECK-NEXT: br i1 poison, label [[FOR_END_I_I_I:%.*]], label [[SCALAR_PH]]
2020
; CHECK: scalar.ph:
21-
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_LR_PH_I_I_I]] ]
21+
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ poison, [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_LR_PH_I_I_I]] ]
2222
; CHECK-NEXT: br label [[FOR_BODY_I_I_I:%.*]]
2323
; CHECK: for.body.i.i.i:
2424
; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC_I_I_I:%.*]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
2525
; CHECK-NEXT: br label [[FOR_INC_I_I_I]]
2626
; CHECK: for.inc.i.i.i:
2727
; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i64 [[INDVARS_IV]], 1
2828
; CHECK-NEXT: [[LFTR_WIDEIV:%.*]] = trunc i64 [[INDVARS_IV_NEXT]] to i32
29-
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[LFTR_WIDEIV]], undef
29+
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[LFTR_WIDEIV]], poison
3030
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY_I_I_I]], label [[FOR_END_I_I_I]], !llvm.loop [[LOOP3:![0-9]+]]
3131
; CHECK: for.end.i.i.i:
32-
; CHECK-NEXT: [[LCSSA:%.*]] = phi ptr [ undef, [[FOR_INC_I_I_I]] ], [ undef, [[MIDDLE_BLOCK]] ]
32+
; CHECK-NEXT: [[LCSSA:%.*]] = phi ptr [ poison, [[FOR_INC_I_I_I]] ], [ poison, [[MIDDLE_BLOCK]] ]
3333
; CHECK-NEXT: unreachable
3434
;
3535
br label %for.body.lr.ph.i.i.i
@@ -44,19 +44,19 @@ for.body.i.i.i:
4444
for.inc.i.i.i:
4545
%indvars.iv.next = add i64 %indvars.iv, 1
4646
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
47-
%exitcond = icmp ne i32 %lftr.wideiv, undef
47+
%exitcond = icmp ne i32 %lftr.wideiv, poison
4848
br i1 %exitcond, label %for.body.i.i.i, label %for.end.i.i.i
4949

5050
for.end.i.i.i:
51-
%lcssa = phi ptr [ undef, %for.inc.i.i.i ]
51+
%lcssa = phi ptr [ poison, %for.inc.i.i.i ]
5252
unreachable
5353
}
5454

5555
; PR16139
5656
define void @test2(ptr %x) {
5757
; CHECK-LABEL: @test2(
5858
; CHECK-NEXT: entry:
59-
; CHECK-NEXT: indirectbr ptr [[X:%.*]], [label [[L0:%.*]], label %L1]
59+
; CHECK-NEXT: indirectbr ptr [[X:%.*]], [label [[L0:%.*]], label [[L1:%.*]]]
6060
; CHECK: L0:
6161
; CHECK-NEXT: br label [[L0]]
6262
; CHECK: L1:
@@ -76,14 +76,14 @@ L1:
7676
define void @test3() {
7777
; CHECK-LABEL: @test3(
7878
; CHECK-NEXT: entry:
79-
; CHECK-NEXT: [[ADD41:%.*]] = add i32 undef, undef
79+
; CHECK-NEXT: [[ADD41:%.*]] = add i32 poison, poison
8080
; CHECK-NEXT: [[IDXPROM4736:%.*]] = zext i32 [[ADD41]] to i64
8181
; CHECK-NEXT: br label [[WHILE_BODY:%.*]]
8282
; CHECK: while.body:
8383
; CHECK-NEXT: [[IDXPROM4738:%.*]] = phi i64 [ [[IDXPROM47:%.*]], [[WHILE_BODY]] ], [ [[IDXPROM4736]], [[ENTRY:%.*]] ]
8484
; CHECK-NEXT: [[POS_337:%.*]] = phi i32 [ [[INC46:%.*]], [[WHILE_BODY]] ], [ [[ADD41]], [[ENTRY]] ]
8585
; CHECK-NEXT: [[INC46]] = add i32 [[POS_337]], 1
86-
; CHECK-NEXT: [[ARRAYIDX48:%.*]] = getelementptr inbounds [1024 x i8], ptr undef, i64 0, i64 [[IDXPROM4738]]
86+
; CHECK-NEXT: [[ARRAYIDX48:%.*]] = getelementptr inbounds [1024 x i8], ptr poison, i64 0, i64 [[IDXPROM4738]]
8787
; CHECK-NEXT: store i8 0, ptr [[ARRAYIDX48]], align 1
8888
; CHECK-NEXT: [[AND43:%.*]] = and i32 [[INC46]], 3
8989
; CHECK-NEXT: [[CMP44:%.*]] = icmp eq i32 [[AND43]], 0
@@ -95,15 +95,15 @@ define void @test3() {
9595
; CHECK-NEXT: ret void
9696
;
9797
entry:
98-
%add41 = add i32 undef, undef
98+
%add41 = add i32 poison, poison
9999
%idxprom4736 = zext i32 %add41 to i64
100100
br label %while.body
101101

102102
while.body:
103103
%idxprom4738 = phi i64 [ %idxprom47, %while.body ], [ %idxprom4736, %entry ]
104104
%pos.337 = phi i32 [ %inc46, %while.body ], [ %add41, %entry ]
105105
%inc46 = add i32 %pos.337, 1
106-
%arrayidx48 = getelementptr inbounds [1024 x i8], ptr undef, i64 0, i64 %idxprom4738
106+
%arrayidx48 = getelementptr inbounds [1024 x i8], ptr poison, i64 0, i64 %idxprom4738
107107
store i8 0, ptr %arrayidx48, align 1
108108
%and43 = and i32 %inc46, 3
109109
%cmp44 = icmp eq i32 %and43, 0

llvm/test/Transforms/LoopVectorize/nsw-crash.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ while.body.lr.ph:
1313
while.body:
1414
%it.sroa.0.091 = phi ptr [ %p, %while.body.lr.ph ], [ %incdec.ptr.i, %while.body ]
1515
%incdec.ptr.i = getelementptr inbounds i32, ptr %it.sroa.0.091, i64 1
16-
%inc32 = add i32 undef, 1 ; <------------- Make sure we don't set NSW flags to the undef.
17-
%cmp.i11 = icmp eq ptr %incdec.ptr.i, undef
16+
%inc32 = add i32 poison, 1 ; <------------- Make sure we don't set NSW flags to the poison.
17+
%cmp.i11 = icmp eq ptr %incdec.ptr.i, poison
1818
br i1 %cmp.i11, label %while.end, label %while.body
1919

2020
while.end:

llvm/test/Transforms/LoopVectorize/scev-exitlim-crash.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ entry:
1818
for.cond: ; preds = %for.cond, %entry
1919
%i.0 = phi i32 [ poison, %entry ], [ %inc, %for.cond ]
2020
%cmp = icmp slt i32 %i.0, 0
21-
%fsub = fsub double undef, undef
21+
%fsub = fsub double 0.0e+00, 0.0e+00
2222
%fadd = fadd double %fsub, 1.000000e+00
2323
%call = tail call i32 @fn2(double %fadd) #2
2424
%inc = add nsw i32 %i.0, 1

llvm/test/Transforms/LoopVectorize/value-ptr-bug.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
55
; PR16073
66

77
; Because we were caching value pointers across a function call that could RAUW
8-
; we would generate an undefined value store below:
8+
; we would generate an poison value store below:
99
; SCEVExpander::expandCodeFor would change a value (the start value of an
1010
; induction) that we cached in the induction variable list.
1111

1212
; CHECK-LABEL: @test_vh(
13-
; CHECK-NOT: store <4 x i8> undef
13+
; CHECK-NOT: store <4 x i8> poison
1414

1515
define void @test_vh(ptr %ptr265, ptr %ptr266, i32 %sub267) {
1616
entry:

llvm/test/Transforms/LoopVectorize/vector-to-scalar-cast.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ define void @vector_to_scalar_cast(ptr %out) {
77
; CHECK-LABEL: define void @vector_to_scalar_cast(
88
; CHECK-SAME: ptr [[OUT:%.*]]) {
99
; CHECK-NEXT: [[ENTRY:.*]]:
10-
; CHECK-NEXT: [[VEC0:%.*]] = insertelement <2 x i16> undef, i16 0, i64 0
10+
; CHECK-NEXT: [[VEC0:%.*]] = insertelement <2 x i16> poison, i16 0, i64 0
1111
; CHECK-NEXT: [[VEC1:%.*]] = insertelement <2 x i16> [[VEC0]], i16 0, i64 1
1212
; CHECK-NEXT: br label %[[LOOP:.*]]
1313
; CHECK: [[LOOP]]:
@@ -22,7 +22,7 @@ define void @vector_to_scalar_cast(ptr %out) {
2222
; CHECK-NEXT: ret void
2323
;
2424
entry:
25-
%vec0 = insertelement <2 x i16> undef, i16 0, i64 0
25+
%vec0 = insertelement <2 x i16> poison, i16 0, i64 0
2626
%vec1 = insertelement <2 x i16> %vec0, i16 0, i64 1
2727
br label %loop
2828

llvm/test/Transforms/LoopVectorize/version-mem-access.ll

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -169,49 +169,3 @@ loop:
169169
exit:
170170
ret void
171171
}
172-
173-
; Make sure we do not crash when the stride is undef.
174-
define void @stride_undef(ptr %dst) mustprogress {
175-
; CHECK-LABEL: define void @stride_undef(
176-
; CHECK-SAME: ptr [[DST:%.*]]) #[[ATTR0]] {
177-
; CHECK-NEXT: [[ENTRY:.*:]]
178-
; CHECK-NEXT: [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 undef, i64 1)
179-
; CHECK-NEXT: [[TMP0:%.*]] = udiv i64 99, [[UMAX]]
180-
; CHECK-NEXT: [[TMP1:%.*]] = add nuw nsw i64 [[TMP0]], 2
181-
; CHECK-NEXT: br label %[[VECTOR_PH:.*]]
182-
; CHECK: [[VECTOR_PH]]:
183-
; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[TMP1]], 2
184-
; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 [[TMP1]], [[N_MOD_VF]]
185-
; CHECK-NEXT: [[TMP2:%.*]] = mul i64 [[N_VEC]], undef
186-
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
187-
; CHECK: [[VECTOR_BODY]]:
188-
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
189-
; CHECK-NEXT: [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], undef
190-
; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[OFFSET_IDX]], 0
191-
; CHECK-NEXT: [[TMP4:%.*]] = add i64 [[OFFSET_IDX]], undef
192-
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i8, ptr [[DST]], i64 [[TMP3]]
193-
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[DST]], i64 [[TMP4]]
194-
; CHECK-NEXT: store i8 0, ptr [[TMP5]], align 1
195-
; CHECK-NEXT: store i8 0, ptr [[TMP6]], align 1
196-
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 2
197-
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
198-
; CHECK-NEXT: br i1 [[TMP7]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]
199-
; CHECK: [[MIDDLE_BLOCK]]:
200-
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[TMP1]], [[N_VEC]]
201-
; CHECK-NEXT: br i1 [[CMP_N]], [[EXIT:label %.*]], label %[[SCALAR_PH:.*]]
202-
; CHECK: [[SCALAR_PH]]:
203-
;
204-
entry:
205-
br label %loop
206-
207-
loop:
208-
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
209-
%gep.dst = getelementptr i8, ptr %dst, i64 %iv
210-
store i8 0, ptr %gep.dst, align 1
211-
%iv.next = add nuw nsw i64 %iv, undef
212-
%ec = icmp samesign ult i64 %iv, 100
213-
br i1 %ec, label %loop, label %exit
214-
215-
exit:
216-
ret void
217-
}

0 commit comments

Comments
 (0)