[llvm] [NFC][LV] Separate control-flow masking from tail-folding masking. (PR #169509)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 06:42:23 PDT 2026


================
@@ -718,10 +721,11 @@ class LoopVectorizationLegality {
   /// which a reduction can be computed.
   AssumptionCache *AC;
 
-  /// While vectorizing these instructions we have to generate a
-  /// call to the appropriate masked intrinsic or drop them in case of
-  /// conditional assumes.
-  SmallPtrSet<const Instruction *, 8> MaskedOp;
+  /// Instructions that require masking because they are in source-level
+  /// conditionally executed blocks.
+  SmallPtrSet<const Instruction *, 8> ConditionallyExecutedOps;
+  /// Instructions that require masking only due to tail-folding predication.
+  SmallPtrSet<const Instruction *, 8> TailFoldedMaskedOp;
----------------
sdesmalen-arm wrote:

Just something I noticed when reviewing the stacked PR series (#207815); Can `TailFoldedMaskedOp` be moved to the CostModel instead? This function is only used by the cost-model, and if this would be moved there than the 'TailFolded' argument would become unnecessary. i.e. legalisation tells whether a mask is required due to semantics from the original source program, whereas the cost-model would also return true if it's required for the chosen style of vectorization.

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


More information about the llvm-commits mailing list