[llvm] [LV] Replace "BinOp" with "ExtendedOp" in partial reduction transforms (NFCI) (PR #192422)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 05:45:21 PDT 2026
================
@@ -6004,57 +6004,62 @@ struct ExtendedReductionOperand {
};
/// A chain of recipes that form a partial reduction. Matches either
-/// reduction_bin_op (extend (A), accumulator), or
-/// reduction_bin_op (bin_op (extend (A), (extend (B))), accumulator).
+/// reduction_bin_op (extended op, accumulator), or
+/// reduction_bin_op (accumulator, extended op).
+/// The possible forms of the "extended op" are listed in
+/// matchExtendedReductionOperand.
struct VPPartialReductionChain {
/// The top-level binary operation that forms the reduction to a scalar
/// after the loop body.
VPWidenRecipe *ReductionBinOp = nullptr;
/// The user of the extends that is then reduced.
ExtendedReductionOperand ExtendedOp;
- unsigned ScaleFactor;
/// The recurrence kind for the entire partial reduction chain.
/// This allows distinguishing between Sub and AddWithSub recurrences,
/// when the ReductionBinOp is a Instruction::Sub.
RecurKind RK;
+ /// The index of the accumulator operand of ReductionBinOp. The extended op
+ /// is `1 - AccumulatorOpIdx`.
+ unsigned AccumulatorOpIdx;
+ unsigned ScaleFactor;
};
static VPSingleDefRecipe *
-optimizeExtendsForPartialReduction(VPSingleDefRecipe *BinOp,
+optimizeExtendsForPartialReduction(VPSingleDefRecipe *ExtendedOp,
----------------
sdesmalen-arm wrote:
nit: maybe just call this `Op` ?
https://github.com/llvm/llvm-project/pull/192422
More information about the llvm-commits
mailing list