[PATCH] D143905: [LV] Harden the test of the minmax with index pattern. (NFC)
Mel Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 20 03:14:59 PST 2023
Mel-Chen updated this revision to Diff 498782.
Mel-Chen added a comment.
Rebase.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143905/new/
https://reviews.llvm.org/D143905
Files:
llvm/test/Transforms/LoopVectorize/select-min-index.ll
Index: llvm/test/Transforms/LoopVectorize/select-min-index.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/select-min-index.ll
+++ llvm/test/Transforms/LoopVectorize/select-min-index.ll
@@ -1,3 +1,4 @@
+; RUN: opt -passes=loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -S %s | FileCheck %s
; RUN: opt -passes=loop-vectorize -force-vector-width=4 -force-vector-interleave=2 -S %s | FileCheck %s
; RUN: opt -passes=loop-vectorize -force-vector-width=1 -force-vector-interleave=2 -S %s | FileCheck %s
@@ -28,6 +29,33 @@
ret i64 %res
}
+define i64 @test_vectorize_select_umin_idx_all_exit_inst(ptr %src, ptr %umin) {
+; CHECK-LABEL: @test_vectorize_select_umin_idx_all_exit_inst(
+; CHECK-NOT: vector.body:
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+ %min.idx = phi i64 [ 0, %entry ], [ %min.idx.next, %loop ]
+ %min.val = phi i64 [ 0, %entry ], [ %min.val.next, %loop ]
+ %gep = getelementptr i64, ptr %src, i64 %iv
+ %l = load i64, ptr %gep
+ %cmp = icmp ugt i64 %min.val, %l
+ %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
+ br i1 %exitcond.not, label %exit, label %loop
+
+exit:
+ %res = phi i64 [ %min.idx.next, %loop ]
+ %res.umin = phi i64 [ %min.val.next, %loop ]
+ store i64 %res.umin, ptr %umin
+ ret i64 %res
+}
+
define i64 @test_vectorize_select_umin_idx_min_ops_switched(ptr %src) {
; CHECK-LABEL: @test_vectorize_select_umin_idx_min_ops_switched(
; CHECK-NOT: vector.body:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143905.498782.patch
Type: text/x-patch
Size: 1697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230220/950c5de4/attachment.bin>
More information about the llvm-commits
mailing list