[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).
+
+ auto *I = cast_or_null<Instruction>(VPI->getUnderlyingValue());
+ if (!I)
+ // Wouldn't be able to create a `VPReplicateRecipe` anyway.
+ continue;
----------------
fhahn wrote:
consistent with other early continues
```suggestion
// Wouldn't be able to create a `VPReplicateRecipe` anyway.
if (!I)
continue;
```
https://github.com/llvm/llvm-project/pull/184267
More information about the llvm-commits
mailing list