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

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 06:41:43 PST 2025


================
@@ -2413,8 +2419,12 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
   /// Generate the phi/select nodes.
   void execute(VPTransformState &State) override;
 
-  /// Get the factor that the VF of this recipe's output should be scaled by.
-  unsigned getVFScaleFactor() const { return VFScaleFactor; }
+  /// Get the factor that the VF of this recipe's output should be scaled by, or
+  /// null if it isn't scaled.
+  std::optional<unsigned> getVFScaleFactor() const {
+    auto *Partial = std::get_if<RdxPartial>(&Style);
+    return Partial ? std::make_optional(Partial->VFScaleFactor) : std::nullopt;
----------------
gbossu wrote:

Note: I think I suggested this here due to `ScaleFactor` having a confusing definition: https://github.com/llvm/llvm-project/pull/147513#discussion_r2444621245

Now that we have a variant for the reduction style, we might be able to do better.

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


More information about the llvm-commits mailing list