[llvm] [LV] Bundle sub reductions into VPExpressionRecipe (PR #147255)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 07:44:00 PDT 2025


================
@@ -3151,23 +3151,23 @@ static VPExpressionRecipe *
 tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
                                           VPCostContext &Ctx, VFRange &Range) {
   unsigned Opcode = RecurrenceDescriptor::getOpcode(Red->getRecurrenceKind());
-  if (Opcode != Instruction::Add)
+  if (Opcode != Instruction::Add && Opcode != Instruction::Sub)
     return nullptr;
 
   Type *RedTy = Ctx.Types.inferScalarType(Red);
 
   // Clamp the range if using multiply-accumulate-reduction is profitable.
   auto IsMulAccValidAndClampRange =
-      [&](bool isZExt, VPWidenRecipe *Mul, VPWidenCastRecipe *Ext0,
+      [&](bool IsZExt, VPWidenRecipe *Mul, VPWidenCastRecipe *Ext0,
----------------
sdesmalen-arm wrote:

this rename is NFC, maybe remove it from this PR?

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


More information about the llvm-commits mailing list