[llvm] [LV] Don't create partial reductions if factor doesn't match accumulator (PR #158603)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 01:39:58 PDT 2025


================
@@ -8176,6 +8179,10 @@ VPRecipeBuilder::tryToCreatePartialReduction(Instruction *Reduction,
       isa<VPPartialReductionRecipe>(BinOpRecipe))
     std::swap(BinOp, Accumulator);
 
+  if (ScaleFactor !=
----------------
sdesmalen-arm wrote:

Why does the scale-factor of the accumulator (PHI) not match that of the reduction? Is there something missing elsewhere that causes this to not match?

Possibly unrelated, but when I print the values of BinOp/Accumulator, I see that `BinOp = WIDEN_REDUCTION-PHI` and `Accumulator = WIDEN-CAST`, which is then swapped above to result in `BinOp = WIDEN-CAST`. That does not look like a binary-op to me, so. Is this poorly named or does the code actually assume a 'dot-product'-like operation which is not what it gets?

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


More information about the llvm-commits mailing list