[llvm] [LV] Add support for absolute difference partial reductions (PR #188043)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 01:14:35 PDT 2026
================
@@ -6406,10 +6445,11 @@ void VPlanTransforms::createPartialReductions(VPlan &Plan,
PartialCost += LinkCost;
RegularCost += Link.ReductionBinOp->computeCost(VF, CostCtx);
- if (ExtendedOp.BinOp && ExtendedOp.BinOp != Link.ReductionBinOp)
- RegularCost += ExtendedOp.BinOp->computeCost(VF, CostCtx);
- for (VPWidenCastRecipe *Extend : ExtendedOp.CastRecipes)
- if (Extend)
+ // If ExtendB is not none, then the "ExtendsUser" is the binary operation.
+ if (ExtendedOp.ExtendB.Kind != ExtendKind::PR_None)
+ RegularCost += ExtendedOp.ExtendsUser->computeCost(VF, CostCtx);
+ for (VPValue *Op : ExtendedOp.ExtendsUser->operands())
+ if (auto *Extend = dyn_cast<VPWidenCastRecipe>(Op))
----------------
fhahn wrote:
Right, this makes me wonder if the absolute-difference fold may be profitable in some cases without partial reductions as well?
https://github.com/llvm/llvm-project/pull/188043
More information about the llvm-commits
mailing list