[llvm] [LV] NFCI: Create VPExpressions in transformToPartialReductions. (PR #182863)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 01:24:33 PDT 2026


================
@@ -6130,6 +6148,12 @@ static void transformToPartialReduction(const VPPartialReductionChain &Chain,
     ExitValue->replaceAllUsesWith(PartialRed);
   WidenRecipe->replaceAllUsesWith(PartialRed);
 
+  // For cost-model purposes, see if we can fold this into a VPExpression.
+  if (VPExpressionRecipe *E = createPartialReductionExpression(PartialRed)) {
----------------
sdesmalen-arm wrote:

It theoretically could if the BinOp was not a Mul/FMul, but at the moment `getPartialReductionCost` would return an invalid cost for that. If we always want partial reductions to be represented by a VPExpression, then we should limit `matchExtendedReductionOperand` to always limit to Mul/FMul.

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


More information about the llvm-commits mailing list