[llvm] [VPlan] Move addExplicitVectorLength to tryToBuildVPlanWithVPRecipes (PR #166164)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 7 00:51:35 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);
----------------
lukel97 wrote:
I wasn't planning on creating a helper function. I think the change you suggested matches the AVL though, not the EVL. I think we need something like `bind_and_match_ty` from PatternMatch.h where we can both match and capture a value
https://github.com/llvm/llvm-project/pull/166164
More information about the llvm-commits
mailing list