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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 15 20:13:47 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))) {
----------------
lukel97 wrote:

We want just regular post order here, RPOT would traverse defs before uses. The block itself is reversed though so we go from bottom to top

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


More information about the llvm-commits mailing list