[llvm] [LV] Add initial support for partial alias masking (PR #177599)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 15 09:19:53 PST 2026


================
@@ -300,9 +300,17 @@ class LoopVectorizationLegality {
   /// masking.
   bool canFoldTailByMasking() const;
 
+  /// Returns true if all instructions in the loop support masking or
+  /// speculation.
+  ///
+  /// The mask may be loop-invariant if it represents a maximum safe dependence
+  /// distance (alias mask) or loop-variant if it is based on the induction
+  /// variable (e.g. tail-folding).
+  bool canMaskLoop() const;
----------------
fhahn wrote:

> I don't believe that would simplify much. You can't just updated the header mask as you have to account for the different step size in the main loop too.

I might be missing something, but wouldn't it remove all changes in `LoopVectorizationLegality.h`, `VPlanUtils`,  `VPlanAnalysis`, `VPlanPredicator`, need to add `AliasMask` to VPlan etc?


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


More information about the llvm-commits mailing list