[llvm] [VPlan] Sink vector loop region recipes in licm (PR #172343)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 6 02:06:45 PST 2026


================
@@ -2521,6 +2521,34 @@ 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<VPBasicBlock *, 4> UserVPBBs;
----------------
Mel-Chen wrote:

Could we use SmallPtrSet here? 

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


More information about the llvm-commits mailing list