================
@@ -5039,10 +5039,26 @@ calculateRegisterUsage(VPlan &Plan,
ArrayRef<ElementCount> VFs,
// even in the scalar case.
RegUsage[ClassID] += 1;
} else {
+ ElementCount VF = VFs[J];
+ // The output from scaled phis and scaled reductions actually has
+ // fewer lanes than the VF.
+ if (isa<VPPartialReductionRecipe, VPReductionPHIRecipe>(R)) {
+ auto *ReductionR = dyn_cast<VPReductionPHIRecipe>(R);
+ auto *PartialReductionR = ReductionR ? nullptr :
dyn_cast<VPPartialReductionRecipe>(R);
+ unsigned ScaleFactor = ReductionR ?
ReductionR->getVFScaleFactor() : PartialReductionR->getVFScaleFactor();
+ VF = VF.divideCoefficientBy(ScaleFactor);
+ }
----------------
sdesmalen-arm wrote:
Maybe create a utility function that returns the scaling factor a `Recipe`,
which returns `1` for any recipe other than the
`VPPartialReductionRecipe/VPReductionPHIRecipe`.
Also, please run clang-format on your code.
https://github.com/llvm/llvm-project/pull/133090
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits