[llvm] [LV] Prefer fixed VFs for epilogue vectorization (PR #211814)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 04:18:22 PDT 2026


================
@@ -706,6 +706,21 @@ bool LoopVectorizationPlanner::isMoreProfitable(const VectorizationFactor &A,
         !B.Width.isScalar())
       return true;
 
+  // Prefer fixed VFs for epilogue loops (unless the fixed cost is much more
+  // expensive -- >= 2x). There are some extra costs for using scalable vectors
----------------
david-arm wrote:

I don't see anything in the logic below that suggests the threshold ratio between fixed and scalable cost is 2. In the code below it has:

```
    if (FixedCost / ScalableCost <= 1)
      return A.Width.isFixed();
```

which suggests if the fixed cost <= scalable cost prefer fixed-width. Using a ratio of 2 here it should be

```
    if (FixedCost / ScalableCost <= 2.0)
      return A.Width.isFixed();
```

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


More information about the llvm-commits mailing list