[llvm] [VPlan] Sink vector loop region recipes in licm (PR #172343)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 15 14:04:20 PST 2025
================
@@ -2465,6 +2465,33 @@ static void licm(VPlan &Plan) {
R.moveBefore(*Preheader, Preheader->end());
}
}
+
+ // Sink any recipes which don't have any users in the region to the nearest
+ // common dominator of its users.
+ VPDominatorTree VPDT(Plan);
+ for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
+ vp_post_order_shallow(LoopRegion->getEntry()))) {
+ for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
+ if (cannotHoistOrSinkRecipe(R))
+ continue;
+ SmallSetVector<VPRecipeBase *, 4> Users;
+ if (any_of(R.definedValues(), [&Users](VPValue *V) {
+ return any_of(V->users(), [&Users](VPUser *U) {
+ auto *UR = cast<VPRecipeBase>(U);
+ Users.insert(UR);
+ return UR->getParent()->getEnclosingLoopRegion();
----------------
artagnon wrote:
Why is a nullptr enclosing loop the right condition for a bail-out?
https://github.com/llvm/llvm-project/pull/172343
More information about the llvm-commits
mailing list