[llvm] [LV] NFCI: Add RecurKind to VPPartialReductionChain (PR #181705)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 17 01:56:32 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)
----------------
sdesmalen-arm wrote:

`RedPhiR` shouldn't be modified here, because then you can't use the original `RedPhiR` anymore after this point. The reason the code is intended to be NFC (NFCI) is because if it doesn't go into this `if()` block, then `RedPhiR == PhiOp` is always true as per these two statements on lines 5944-5945. Similar on lines 5973-5974, so the original condition on this line would never evaluate to true.

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


More information about the llvm-commits mailing list