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

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 08:19:46 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);
-  }
----------------
SamTebbs33 wrote:

Yeah you're right, that compute cost function isn't considering the predicate. I moved it over locally and that regressed the codegen for the mve-reductions.ll tests. I think this change should be done separately since it's outside the scope of the PR. Are you okay with that?

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


More information about the llvm-commits mailing list