[llvm] [VPlan] Scalarize to first-lane-only directly on VPlan (PR #184267)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 23:55:51 PDT 2026


================
@@ -6541,3 +6541,60 @@ void VPlanTransforms::makeMemOpWideningDecisions(
     ReplaceWith(Recipe);
   }
 }
+
+void VPlanTransforms::makeScalarizationDecisions(VPlan &Plan, VFRange &Range) {
+  if (LoopVectorizationPlanner::getDecisionAndClampRange(
+          [&](ElementCount VF) { return VF.isScalar(); }, Range))
+    return;
+
+  // Extend lifetime per `llvm::PostOrderTraversal` documentation:
+  auto PO =
+      vp_post_order_shallow(Plan.getVectorLoopRegion()->getEntryBasicBlock());
+
+  for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(PO)) {
----------------
artagnon wrote:

Would be good to be explicitly call PostOrderTraversal, so we can remove the now-misleading vp_post_order_{deep,shallow} helpers?

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


More information about the llvm-commits mailing list