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

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 08:08:51 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;
----------------
SamTebbs33 wrote:

Done. I've made 1 the default case.

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


More information about the llvm-commits mailing list