[llvm] [LV] Bundle partial reductions inside VPExpressionRecipe (PR #147302)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 6 00:21:01 PDT 2025
================
@@ -3520,16 +3532,29 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
// Clamp the range if using multiply-accumulate-reduction is profitable.
auto IsMulAccValidAndClampRange =
- [&](bool isZExt, VPWidenRecipe *Mul, VPWidenCastRecipe *Ext0,
- VPWidenCastRecipe *Ext1, VPWidenCastRecipe *OuterExt) -> bool {
+ [&](VPWidenRecipe *Mul, VPWidenCastRecipe *Ext0, VPWidenCastRecipe *Ext1,
+ VPWidenCastRecipe *OuterExt) -> bool {
return LoopVectorizationPlanner::getDecisionAndClampRange(
[&](ElementCount VF) {
+ if (IsPartialReduction) {
+ // The VF ranges have already been clamped for a partial reduction
+ // and its existence confirms that it's valid, so we don't need to
+ // perform any cost checks or more clamping.
----------------
fhahn wrote:
I meant that we check/assert here the costs we compute below also indicate that the bundling is profitable (and hence compute the same costs we used when deciding to form the partial reduction early on)
https://github.com/llvm/llvm-project/pull/147302
More information about the llvm-commits
mailing list