Skip to content

Commit 0158d86

Browse files
committed
[LV] Change the test cases to ensure that the trip count is not zero. (NFC)
Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D154415
1 parent f3059e2 commit 0158d86

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

llvm/test/Transforms/LoopVectorize/select-min-index.ll

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
; Test cases for selecting the index with the minimum value.
66

7-
define i64 @test_vectorize_select_umin_idx(ptr %src) {
7+
define i64 @test_vectorize_select_umin_idx(ptr %src, i64 %n) {
88
; CHECK-LABEL: @test_vectorize_select_umin_idx(
99
; CHECK-NOT: vector.body:
1010
;
@@ -21,15 +21,15 @@ loop:
2121
%min.val.next = tail call i64 @llvm.umin.i64(i64 %min.val, i64 %l)
2222
%min.idx.next = select i1 %cmp, i64 %iv, i64 %min.idx
2323
%iv.next = add nuw nsw i64 %iv, 1
24-
%exitcond.not = icmp eq i64 %iv.next, 0
24+
%exitcond.not = icmp eq i64 %iv.next, %n
2525
br i1 %exitcond.not, label %exit, label %loop
2626

2727
exit:
2828
%res = phi i64 [ %min.idx.next, %loop ]
2929
ret i64 %res
3030
}
3131

32-
define i64 @test_vectorize_select_umin_idx_all_exit_inst(ptr %src, ptr %umin) {
32+
define i64 @test_vectorize_select_umin_idx_all_exit_inst(ptr %src, ptr %umin, i64 %n) {
3333
; CHECK-LABEL: @test_vectorize_select_umin_idx_all_exit_inst(
3434
; CHECK-NOT: vector.body:
3535
;
@@ -46,7 +46,7 @@ loop:
4646
%min.val.next = tail call i64 @llvm.umin.i64(i64 %min.val, i64 %l)
4747
%min.idx.next = select i1 %cmp, i64 %iv, i64 %min.idx
4848
%iv.next = add nuw nsw i64 %iv, 1
49-
%exitcond.not = icmp eq i64 %iv.next, 0
49+
%exitcond.not = icmp eq i64 %iv.next, %n
5050
br i1 %exitcond.not, label %exit, label %loop
5151

5252
exit:
@@ -56,7 +56,7 @@ exit:
5656
ret i64 %res
5757
}
5858

59-
define i64 @test_vectorize_select_umin_idx_min_ops_switched(ptr %src) {
59+
define i64 @test_vectorize_select_umin_idx_min_ops_switched(ptr %src, i64 %n) {
6060
; CHECK-LABEL: @test_vectorize_select_umin_idx_min_ops_switched(
6161
; CHECK-NOT: vector.body:
6262
;
@@ -73,15 +73,15 @@ loop:
7373
%min.val.next = tail call i64 @llvm.umin.i64(i64 %l, i64 %min.val)
7474
%min.idx.next = select i1 %cmp, i64 %iv, i64 %min.idx
7575
%iv.next = add nuw nsw i64 %iv, 1
76-
%exitcond.not = icmp eq i64 %iv.next, 0
76+
%exitcond.not = icmp eq i64 %iv.next, %n
7777
br i1 %exitcond.not, label %exit, label %loop
7878

7979
exit:
8080
%res = phi i64 [ %min.idx.next, %loop ]
8181
ret i64 %res
8282
}
8383

84-
define i64 @test_not_vectorize_select_no_min_reduction(ptr %src) {
84+
define i64 @test_not_vectorize_select_no_min_reduction(ptr %src, i64 %n) {
8585
; CHECK-LABEL: @test_not_vectorize_select_no_min_reduction(
8686
; CHECK-NOT: vector.body:
8787
;
@@ -99,7 +99,7 @@ loop:
9999
%foo = call i64 @llvm.umin.i64(i64 %min.val, i64 %l)
100100
%min.idx.next = select i1 %cmp, i64 %iv, i64 %min.idx
101101
%iv.next = add nuw nsw i64 %iv, 1
102-
%exitcond.not = icmp eq i64 %iv.next, 0
102+
%exitcond.not = icmp eq i64 %iv.next, %n
103103
br i1 %exitcond.not, label %exit, label %loop
104104

105105
exit:
@@ -108,7 +108,7 @@ exit:
108108
}
109109

110110

111-
define i64 @test_not_vectorize_cmp_value(i64 %x) {
111+
define i64 @test_not_vectorize_cmp_value(i64 %x, i64 %n) {
112112
; CHECK-LABEL: @test_not_vectorize_cmp_value(
113113
; CHECK-NOT: vector.body:
114114
;
@@ -123,15 +123,15 @@ loop:
123123
%min.val.next = tail call i64 @llvm.umin.i64(i64 %min.val, i64 0)
124124
%min.idx.next = select i1 %cmp, i64 %iv, i64 %min.idx
125125
%iv.next = add nuw nsw i64 %iv, 1
126-
%exitcond.not = icmp eq i64 %iv.next, 0
126+
%exitcond.not = icmp eq i64 %iv.next, %n
127127
br i1 %exitcond.not, label %exit, label %loop
128128

129129
exit:
130130
%res = phi i64 [ %min.idx.next, %loop ]
131131
ret i64 %res
132132
}
133133

134-
define i32 @test_vectorize_select_umin_idx_with_trunc() {
134+
define i32 @test_vectorize_select_umin_idx_with_trunc(i64 %n) {
135135
; CHECK-LABEL: @test_vectorize_select_umin_idx_with_trunc(
136136
; CHECK-NOT: vector.body:
137137
;
@@ -147,7 +147,7 @@ loop:
147147
%trunc = trunc i64 %iv to i32
148148
%min.idx.next = select i1 %cmp, i32 %trunc, i32 %min.idx
149149
%iv.next = add nuw nsw i64 %iv, 1
150-
%exitcond.not = icmp eq i64 %iv.next, 0
150+
%exitcond.not = icmp eq i64 %iv.next, %n
151151
br i1 %exitcond.not, label %exit, label %loop
152152

153153
exit:

0 commit comments

Comments
 (0)