[llvm] [LV] NFCI: Add RecurKind to VPPartialReductionChain (PR #181705)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 17 02:34:12 PST 2026
================
@@ -5964,14 +5968,11 @@ getScaledReductions(VPSingleDefRecipe *RedPhiR, VPValue *PrevValue,
// If one is found, we use the discovered reduction instruction in
// place of the accumulator for costing.
if (getScaledReductions(RedPhiR, Op, Chains, CostCtx, Range)) {
- RedPhiR = Chains.rbegin()->ReductionBinOp;
Op = UpdateR->getOperand(0);
PhiOp = UpdateR->getOperand(1);
- if (Op == RedPhiR)
+ if (Op == Chains.rbegin()->ReductionBinOp)
std::swap(Op, PhiOp);
}
- if (RedPhiR != PhiOp)
----------------
MacDue wrote:
> if it doesn't go into this if() block, then RedPhiR == PhiOp is always true as per these two statements on lines 5944-5945
This does not seem to be the case. If you simply replace the `if (RedPhiR != PhiOp) return false;` with `assert(RedPhiR == PhiOp);` that fails in a bunch of tests that are not intended to match partial reductions when the `if (getScaledReductions(...))` block is not entered. I guess they're still rejected by some other matching though.
https://github.com/llvm/llvm-project/pull/181705
More information about the llvm-commits
mailing list