[llvm] [VPlan] Move addExplicitVectorLength to tryToBuildVPlanWithVPRecipes (PR #166164)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 10 02:21:30 PST 2025
================
@@ -2617,8 +2621,40 @@ static VPRecipeBase *optimizeMaskToEVL(VPValue *HeaderMask,
return nullptr;
}
-/// Replace recipes with their EVL variants.
-static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
+void VPlanTransforms::optimizeMasksToEVL(VPlan &Plan) {
+ // Find the EVL-based header mask if it exists: icmp ult step-vector, EVL
+ VPInstruction *HeaderMask = nullptr;
+ for (VPRecipeBase &R : *Plan.getVectorLoopRegion()->getEntryBasicBlock()) {
+ if (match(&R, m_ICmp(m_VPInstruction<VPInstruction::StepVector>(),
+ m_EVL(m_VPValue())))) {
+ HeaderMask = cast<VPInstruction>(&R);
+ break;
+ }
+ }
+ if (!HeaderMask)
+ return;
+
+ VPValue *EVL = HeaderMask->getOperand(1);
----------------
Mel-Chen wrote:
BTW, do we need to update vputils::isHeaderMask?
https://github.com/llvm/llvm-project/pull/166164
More information about the llvm-commits
mailing list