Skip to content

Commit 5344cc9

Browse files
committed
Perform optimizeMasksToEVL as late as possible
So that #149706 doesn't need to worry about EVL recipes
1 parent 6ac7780 commit 5344cc9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8237,6 +8237,13 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
82378237
}
82388238
VF = SubRange.End;
82398239
}
8240+
8241+
if (CM.foldTailWithEVL()) {
8242+
for (auto &Plan : VPlans) {
8243+
VPlanTransforms::runPass(VPlanTransforms::optimizeMasksToEVL, *Plan);
8244+
assert(verifyVPlanIsValid(*Plan) && "VPlan is invalid");
8245+
}
8246+
}
82408247
}
82418248

82428249
VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,6 @@ void VPlanTransforms::optimize(VPlan &Plan) {
23342334
runPass(removeRedundantExpandSCEVRecipes, Plan);
23352335
runPass(simplifyRecipes, Plan);
23362336
runPass(removeBranchOnConst, Plan);
2337-
runPass(optimizeMasksToEVL, Plan);
23382337
runPass(removeDeadRecipes, Plan);
23392338

23402339
runPass(createAndOptimizeReplicateRegions, Plan);
@@ -2654,6 +2653,8 @@ void VPlanTransforms::optimizeMasksToEVL(VPlan &Plan) {
26542653
R->eraseFromParent();
26552654
}
26562655
}
2656+
2657+
removeDeadRecipes(Plan);
26572658
}
26582659

26592660
/// After replacing the IV with a EVL-based IV, fixup recipes that use VF to use

0 commit comments

Comments
 (0)