[llvm] [LV] Use VPReductionRecipe for partial reductions (PR #144908)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 07:37:38 PDT 2025


================
@@ -2591,24 +2528,46 @@ VPExtendedReductionRecipe::computeCost(ElementCount VF,
       cast<VectorType>(toVectorTy(Ctx.Types.inferScalarType(getVecOp()), VF));
   assert(RedTy->isIntegerTy() &&
          "ExtendedReduction only support integer type currently.");
+  if (isPartialReduction())
+    return Ctx.TTI.getPartialReductionCost(Opcode, RedTy, SrcVecTy, SrcVecTy,
+                                           VF, TargetTransformInfo::PR_None,
----------------
fhahn wrote:

Does this now assume that there are no extends? Does this assume that for the real use cases, it will get folded into a VPMulAccumulateRecipe?

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


More information about the llvm-commits mailing list