Skip to content

Commit

Permalink
[LV] Change the test cases to ensure that the trip count is not zero.…
Browse files Browse the repository at this point in the history
… (NFC)

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D154415
  • Loading branch information
Mel-Chen committed Jul 12, 2023
1 parent f3059e2 commit 0158d86
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions llvm/test/Transforms/LoopVectorize/select-min-index.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

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

exit:
%res = phi i64 [ %min.idx.next, %loop ]
ret i64 %res
}

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

exit:
Expand All @@ -56,7 +56,7 @@ exit:
ret i64 %res
}

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

exit:
%res = phi i64 [ %min.idx.next, %loop ]
ret i64 %res
}

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

exit:
Expand All @@ -108,7 +108,7 @@ exit:
}


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

exit:
%res = phi i64 [ %min.idx.next, %loop ]
ret i64 %res
}

define i32 @test_vectorize_select_umin_idx_with_trunc() {
define i32 @test_vectorize_select_umin_idx_with_trunc(i64 %n) {
; CHECK-LABEL: @test_vectorize_select_umin_idx_with_trunc(
; CHECK-NOT: vector.body:
;
Expand All @@ -147,7 +147,7 @@ loop:
%trunc = trunc i64 %iv to i32
%min.idx.next = select i1 %cmp, i32 %trunc, i32 %min.idx
%iv.next = add nuw nsw i64 %iv, 1
%exitcond.not = icmp eq i64 %iv.next, 0
%exitcond.not = icmp eq i64 %iv.next, %n
br i1 %exitcond.not, label %exit, label %loop

exit:
Expand Down

0 comments on commit 0158d86

Please sign in to comment.