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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 07:21:48 PST 2025


================
@@ -304,134 +303,6 @@ bool VPRecipeBase::isScalarCast() const {
   return VPI && Instruction::isCast(VPI->getOpcode());
 }
 
-InstructionCost
-VPPartialReductionRecipe::computeCost(ElementCount VF,
-                                      VPCostContext &Ctx) const {
-  std::optional<unsigned> Opcode;
-  VPValue *Op = getVecOp();
-  uint64_t MulConst;
-
-  InstructionCost CondCost = 0;
-  if (isConditional()) {
-    CmpInst::Predicate Pred = CmpInst::BAD_ICMP_PREDICATE;
-    auto *VecTy = Ctx.Types.inferScalarType(Op);
-    auto *CondTy = Ctx.Types.inferScalarType(getCondOp());
-    CondCost = Ctx.TTI.getCmpSelInstrCost(Instruction::Select, VecTy, CondTy,
-                                          Pred, Ctx.CostKind);
-  }
----------------
fhahn wrote:

I think this should be moved to `VPReductionRecipe::computeCost`. It seems like we may be missing test coverage for this?

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


More information about the llvm-commits mailing list