[llvm] [LV] Simplify the chain traversal in `getScaledReductions()` (NFCI) (PR #184830)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 03:19:34 PST 2026
================
@@ -6055,22 +6049,20 @@ static bool isValidPartialReduction(const VPPartialReductionChain &Chain,
Range);
}
-/// Examines reduction operations to see if the target can use a cheaper
-/// operation with a wider per-iteration input VF and narrower PHI VF.
-/// Recursively calls itself to identify chained scaled reductions.
-/// Returns true if this invocation added an entry to Chains, otherwise false.
-static bool
-getScaledReductions(VPReductionPHIRecipe *RedPhiR, VPValue *PrevValue,
- SmallVectorImpl<VPPartialReductionChain> &Chains,
- VPCostContext &CostCtx, VFRange &Range) {
- auto *UpdateR = dyn_cast<VPWidenRecipe>(PrevValue);
- if (!UpdateR || !Instruction::isBinaryOp(UpdateR->getOpcode()))
- return false;
+/// Holds the binary operation used to compute the extended operand and the
+/// casts that feed into it.
+struct ExtendedReductionOperand {
+ VPWidenRecipe *BinOp = nullptr;
+ std::array<VPWidenCastRecipe *, 2> CastRecipes = {nullptr};
----------------
MacDue wrote:
Yep, wrong constructor :+1: Fixed this
https://github.com/llvm/llvm-project/pull/184830
More information about the llvm-commits
mailing list