[llvm-branch-commits] [llvm] [LV] Reduce register usage for scaled reductions (PR #133090)
Nicholas Guy via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Mar 26 07:30:47 PDT 2025
================
@@ -5026,10 +5026,23 @@ calculateRegisterUsage(VPlan &Plan, ArrayRef<ElementCount> VFs,
// even in the scalar case.
RegUsage[ClassID] += 1;
} else {
+ // The output from scaled phis and scaled reductions actually have
+ // fewer lanes than the VF.
+ auto VF = VFs[J];
+ if (auto *ReductionR = dyn_cast<VPReductionPHIRecipe>(R))
----------------
NickGuy-Arm wrote:
[Idle thought, feel free to ignore]
I wonder if there's precedent to add a `getVFScaleFactor` or equivalent to the base recipe class (or one of the other subclasses), and allow any recipe to override it instead of explicitly checking for every type that could scale the VF.
Likely not yet, and almost certainly not in this patch, but maybe something to consider in the future?
https://github.com/llvm/llvm-project/pull/133090
More information about the llvm-branch-commits
mailing list