[llvm] [LV] Prevent query the computeCost() when VF=1 in emitInvalidCostRemarks(). (PR #117288)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 21:08:25 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Elvis Wang (ElvisWang123)

<details>
<summary>Changes</summary>

We should only query the computeCost() when the VF is vector. 


---
Full diff: https://github.com/llvm/llvm-project/pull/117288.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+3) 


``````````diff
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);

``````````

</details>


https://github.com/llvm/llvm-project/pull/117288


More information about the llvm-commits mailing list