[llvm] [LV] Fix gap mask requirement for interleaved access (PR #151105)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 03:55:38 PDT 2025


================
@@ -2493,7 +2493,8 @@ void VPlanTransforms::createInterleaveGroups(
       }
 
     bool NeedsMaskForGaps =
-        IG->requiresScalarEpilogue() && !ScalarEpilogueAllowed;
+        (IG->requiresScalarEpilogue() && !ScalarEpilogueAllowed) ||
+        (!StoredValues.empty() && (IG->getNumMembers() < IG->getFactor()));
----------------
lukel97 wrote:

I think we can also do this check in VPInterleaveRecipe::execute itself, but for the sake of keeping this in sync with `UseMaskForGaps` from `LoopVectorizationCostModel::getInterleaveGroupCost` its probably better to just do it here.

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


More information about the llvm-commits mailing list