[PATCH] D157969: LoopVectorize/iv-select-cmp: add test for decreasing IV out-of-bound

Ramkumar Ramachandra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 05:20:45 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef48e90489dc: LoopVectorize/iv-select-cmp: add test for decreasing IV out-of-bound (authored by artagnon).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157969/new/

https://reviews.llvm.org/D157969

Files:
  llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll


Index: llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll
+++ llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll
@@ -452,6 +452,28 @@
   ret i64 %cond
 }
 
+define i64 @not_vectorized_select_decreasing_induction_icmp_iv_out_of_bound(ptr nocapture readonly %a) {
+; CHECK-LABEL: @not_vectorized_select_decreasing_induction_icmp_iv_out_of_bound
+; CHECK-NOT:   vector.body:
+;
+entry:
+  br label %for.body
+
+for.body:                                         ; preds = %entry, %for.body
+  %iv = phi i64 [ 9223372036854775807, %entry ], [ %dec, %for.body ]
+  %rdx = phi i64 [ 331, %entry ], [ %spec.select, %for.body ]
+  %arrayidx = getelementptr inbounds i64, ptr %a, i64 %iv
+  %0 = load i64, ptr %arrayidx, align 8
+  %cmp1 = icmp sgt i64 %0, 3
+  %spec.select = select i1 %cmp1, i64 %iv, i64 %rdx
+  %dec = add nsw i64 %iv, -1
+  %cmp.not = icmp eq i64 %iv, 0
+  br i1 %cmp.not, label %exit, label %for.body
+
+exit:                                             ; preds = %for.body
+  ret i64 %spec.select
+}
+
 define i64 @not_vectorized_select_icmp_non_const_iv_start_value(ptr nocapture readonly %a, ptr nocapture readonly %b, i64 %ivstart, i64 %rdx.start, i64 %n) {
 ; CHECK-LABEL: define i64 @not_vectorized_select_icmp_non_const_iv_start_value
 ; CHECK-NOT:   vector.body:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157969.557302.patch
Type: text/x-patch
Size: 1409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230925/57bf9610/attachment.bin>


More information about the llvm-commits mailing list