[llvm] [LoopVectorizer] Add support for partial reductions (PR #92418)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 03:25:48 PDT 2024


================
@@ -293,6 +293,31 @@ struct FixedScalableVFPair {
   bool hasVector() const { return FixedVF.isVector() || ScalableVF.isVector(); }
 };
 
+/// A chain of instructions that form a partial reduction.
+/// Designed to match: reduction_bin_op (bin_op (extend (A), (extend (B))),
+/// accumulator)
+struct PartialReductionChain {
+  /// The top-level binary operation that forms the reduction to a scalar after
+  /// the loop body
+  Instruction *Reduction;
+  /// The inner binary operation that forms the reduction to a vector value
+  /// within the loop body
+  Instruction *BinOp;
+  /// The extension of each of the inner binary operation's operands
+  Instruction *ExtendA;
+  Instruction *ExtendB;
+
+  /// The inner binary operation's operands
+  Value *InputA;
----------------
huntergr-arm wrote:

`InputA` and `InputB` are recorded but never used outside the function which matches them.

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


More information about the llvm-commits mailing list