[llvm-branch-commits] [llvm] [LV] Bundle (partial) reductions with a mul of a constant (PR #162503)
Sander de Smalen via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 23 03:58:26 PDT 2025
================
@@ -3589,6 +3596,42 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
Sub = VecOp->getDefiningRecipe();
VecOp = Tmp;
}
+
+ // If ValB is a constant and can be safely extended, truncate it to the same
+ // type as ExtA's operand, then extend it to the same type as ExtA. This
+ // creates two uniform extends that can more easily be matched by the rest of
+ // the bundling code. The ExtB reference, ValB and operand 1 of Mul are all
+ // replaced with the new extend of the constant.
+ auto ExtendAndReplaceConstantOp = [&Ctx](VPWidenCastRecipe *ExtA,
+ VPWidenCastRecipe *&ExtB,
+ VPValue *&ValB, VPWidenRecipe *Mul) {
+ if (ExtA && !ExtB && ValB->isLiveIn()) {
----------------
sdesmalen-arm wrote:
nit: maybe bail out early here and for the `if (Const && llvm::canConstantBeExtended(..))` case, rather than having a multi-nested if-statement.
https://github.com/llvm/llvm-project/pull/162503
More information about the llvm-branch-commits
mailing list