[llvm] [LV] Reduce register usage for scaled reductions (PR #133090)
Sam Tebbs via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 10 03:01:43 PDT 2025
================
@@ -5028,10 +5041,19 @@ calculateRegisterUsage(VPlan &Plan, ArrayRef<ElementCount> VFs,
// even in the scalar case.
RegUsage[ClassID] += 1;
} else {
+ // The output from scaled phis and scaled reductions actually has
+ // fewer lanes than the VF.
+ unsigned ScaleFactor = getVFScaleFactor(R);
+ ElementCount VF = VFs[J].divideCoefficientBy(ScaleFactor);
+ LLVM_DEBUG(if (VF != VFs[J]) {
+ dbgs() << "LV(REG): Scaled down VF from " << VFs[J] << " to " << VF
----------------
SamTebbs33 wrote:
Unfortunately the VF that has partial reductions is pruned before the register usage is calculated. I can add one as part of https://github.com/llvm/llvm-project/pull/132190 once this is merged, though.
https://github.com/llvm/llvm-project/pull/133090
More information about the llvm-commits
mailing list