[llvm] [LV] Use VPReductionRecipe for partial reductions (PR #144908)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 08:39:02 PDT 2025


================
@@ -564,8 +564,9 @@ SmallVector<VPRegisterUsage, 8> llvm::calculateRegisterUsageForPlan(
         } 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);
+          ElementCount VF = VFs[J];
+          if (unsigned ScaleFactor = getVFScaleFactor(R); ScaleFactor > 1)
+            VF = VF.divideCoefficientBy(ScaleFactor);
----------------
sdesmalen-arm wrote:

nit: This can be:
```suggestion
          if (unsigned ScaleFactor = getVFScaleFactor(R))
            VF = VF.divideCoefficientBy(ScaleFactor);
```
because scaling by 1 should result in the same VF.

https://github.com/llvm/llvm-project/pull/144908


More information about the llvm-commits mailing list