[llvm] f0c674f - [LV] Add test showing cost is computed when there are no vector plans.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 00:10:34 PDT 2024


Author: Florian Hahn
Date: 2024-06-24T08:08:56+01:00
New Revision: f0c674f680e3e3301c7ccd429400690b128172c5

URL: https://github.com/llvm/llvm-project/commit/f0c674f680e3e3301c7ccd429400690b128172c5
DIFF: https://github.com/llvm/llvm-project/commit/f0c674f680e3e3301c7ccd429400690b128172c5.diff

LOG: [LV] Add test showing cost is computed when there are no vector plans.

Add test showing unnecessary cost computations, as no vector VPlans are
generated.

Added: 
    llvm/test/Transforms/LoopVectorize/RISCV/only-compute-cost-for-vplan-vfs.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopVectorize/RISCV/only-compute-cost-for-vplan-vfs.ll b/llvm/test/Transforms/LoopVectorize/RISCV/only-compute-cost-for-vplan-vfs.ll
new file mode 100644
index 0000000000000..da44245578403
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/RISCV/only-compute-cost-for-vplan-vfs.ll
@@ -0,0 +1,28 @@
+; RUN: opt -passes=loop-vectorize -force-tail-folding-style=data-with-evl \
+; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \
+; RUN: -mtriple=riscv64 -mattr=+v -S -debug %s 2>&1 | FileCheck %s
+
+; REQUIRES: asserts
+
+; Make sure we do not vectorize a loop with a widened int induction.
+; TODO: There's no need to compute costs for any VF, as no VPlans have been generated.
+define void @test_wide_integer_induction(ptr noalias %a, i64 %N) {
+; CHECK: LV: Vector loop of width {{.+}} costs:
+;
+; CHECK: define void @test_wide_integer_induction(
+; CHECK-NOT: vector.body
+;
+entry:
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %arrayidx = getelementptr inbounds i64, ptr %a, i64 %iv
+  store i64 %iv, ptr %arrayidx, align 8
+  %iv.next = add nuw nsw i64 %iv, 1
+  %exitcond.not = icmp eq i64 %iv.next, %N
+  br i1 %exitcond.not, label %exit, label %loop
+
+exit:
+  ret void
+}


        


More information about the llvm-commits mailing list