[llvm] [LV] Enable wide active lane masks when tail-folding if preferred (PR #193757)

Kerry McLaughlin via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 08:13:08 PDT 2026


================
@@ -1961,6 +1971,11 @@ class TargetTransformInfo {
   /// processing \p Iters scalar iterations per vector iteration.
   LLVM_ABI bool preferEpilogueVectorization(ElementCount Iters) const;
 
+  /// \returns True if the loop vectorizer should prefer using a single wide
+  /// active lane mask of size VF * UF in tail-folded loops, rather than one
+  /// active lane mask per part.
+  LLVM_ABI bool preferWideActiveLaneMasks() const;
----------------
kmclaughlin-arm wrote:

I've removed the `preferWideActiveLaneMasks` hook and instead now compare the cost of wide vs narrow masks after `selectInterleaveCount`.

I added a dedicated function to return the cost of `get.active.lane.mask` for this, which takes the number of results that the mask will be broken into. This ensures the cost includes the number of vector extracts required.

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


More information about the llvm-commits mailing list