[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
+ // in epilogues (e.g., reduced post-vectorization unrolling) that are not
+ // represented in the cost. TODO: Reconsider this restriction for predicated
+ // epilogues (once supported).
+ if (IsEpilogue && A.Width.isScalable() != B.Width.isScalable() &&
----------------
david-arm wrote:
Why don't we also need a `B.Cost.isValid()`? The maths below only makes sense if both costs are valid.
https://github.com/llvm/llvm-project/pull/211814
More information about the llvm-commits
mailing list