[llvm] [LV] Prevent query the computeCost() when VF=1 in emitInvalidCostRemarks(). (PR #117288)
Elvis Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 21:07:53 PST 2024
https://github.com/ElvisWang123 created https://github.com/llvm/llvm-project/pull/117288
We should only query the computeCost() when the VF is vector.
>From 6f1c1c7f42b068e05a4fb5b5863b462150441061 Mon Sep 17 00:00:00 2001
From: Elvis Wang <elvis.wang at sifive.com>
Date: Thu, 21 Nov 2024 21:02:55 -0800
Subject: [PATCH] [LV] Prevent query the computeCost() when VF=1 in
emitInvalidCostRemarks().
---
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index d13770a35c108f..5a61a6f83e3764 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4373,6 +4373,9 @@ void LoopVectorizationPlanner::emitInvalidCostRemarks(
SmallVector<RecipeVFPair> InvalidCosts;
for (const auto &Plan : VPlans) {
for (ElementCount VF : Plan->vectorFactors()) {
+ if (VF.isScalar())
+ continue;
+
VPCostContext CostCtx(CM.TTI, *CM.TLI, Legal->getWidestInductionType(),
CM);
precomputeCosts(*Plan, VF, CostCtx);
More information about the llvm-commits
mailing list