[llvm] [VPlan] Implement VPReductionRecipe::computeCost(). NFC (PR #107790)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 06:21:02 PDT 2024


================
@@ -1999,6 +1999,27 @@ void VPReductionEVLRecipe::execute(VPTransformState &State) {
   State.set(this, NewRed, 0, /*IsScalar*/ true);
 }
 
+InstructionCost VPReductionRecipe::computeCost(ElementCount VF,
+                                               VPCostContext &Ctx) const {
+  RecurKind RdxKind = RdxDesc.getRecurrenceKind();
+  Type *ElementTy = RdxDesc.getRecurrenceType();
+  auto *VectorTy = cast<VectorType>(ToVectorTy(ElementTy, VF));
----------------
fhahn wrote:

infer the type for the recipe instead and assert that the type matches `RdxDesc.getRecurrenceType()` to ensure consistency?

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


More information about the llvm-commits mailing list