[llvm] [VPlan] Scalarize to first-lane-only directly on VPlan (PR #184267)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 28 01:50:44 PDT 2026
================
@@ -6405,3 +6405,53 @@ void VPlanTransforms::makeMemOpWideningDecisions(
ReplaceWith(Recipe);
}
}
+
+void VPlanTransforms::makeScalarizationDecisions(VPlan &Plan, VFRange &Range) {
+ if (LoopVectorizationPlanner::getDecisionAndClampRange(
+ [&](ElementCount VF) { return VF.isScalar(); }, Range))
+ return;
+
+ PostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> POT(
+ Plan.getEntry());
+ for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(POT)) {
+ for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
+ auto *VPI = dyn_cast<VPInstruction>(&R);
+ if (!VPI)
+ continue;
+
+ // For now we (effectively) only scalarize to first-lane-only address
+ // computation chain for the memory operations such that
+ // MemOp->usesFirstLaneOnly(MemOpAddressOperand).
----------------
fhahn wrote:
```suggestion
// computation chain for the memory operations
```
I think you can strip the code reference here, as the explanation above should be sufficient
https://github.com/llvm/llvm-project/pull/184267
More information about the llvm-commits
mailing list