@@ -2050,6 +2050,10 @@ class VPHeaderPHIRecipe : public VPSingleDefRecipe {
20502050 // / Generate the phi nodes.
20512051 void execute (VPTransformState &State) override = 0;
20522052
2053+ // / Return the cost of this header phi recipe.
2054+ InstructionCost computeCost (ElementCount VF,
2055+ VPCostContext &Ctx) const override ;
2056+
20532057#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
20542058 // / Print the recipe.
20552059 void print (raw_ostream &O, const Twine &Indent,
@@ -2295,6 +2299,10 @@ struct VPFirstOrderRecurrencePHIRecipe : public VPHeaderPHIRecipe {
22952299
22962300 void execute (VPTransformState &State) override ;
22972301
2302+ // / Return the cost of this first-order recurrence phi recipe.
2303+ InstructionCost computeCost (ElementCount VF,
2304+ VPCostContext &Ctx) const override ;
2305+
22982306#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
22992307 // / Print the recipe.
23002308 void print (raw_ostream &O, const Twine &Indent,
@@ -3134,6 +3142,13 @@ class VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe {
31343142 // / canonical, i.e. has the same start and step (of 1) as the canonical IV.
31353143 bool isCanonical (InductionDescriptor::InductionKind Kind, VPValue *Start,
31363144 VPValue *Step) const ;
3145+
3146+ // / Return the cost of this VPCanonicalIVPHIRecipe.
3147+ InstructionCost computeCost (ElementCount VF,
3148+ VPCostContext &Ctx) const override {
3149+ // For now, match the behavior of the legacy cost model.
3150+ return 0 ;
3151+ }
31373152};
31383153
31393154// / A recipe for generating the active lane mask for the vector loop that is
@@ -3196,6 +3211,13 @@ class VPEVLBasedIVPHIRecipe : public VPHeaderPHIRecipe {
31963211 // / TODO: investigate if it can share the code with VPCanonicalIVPHIRecipe.
31973212 void execute (VPTransformState &State) override ;
31983213
3214+ // / Return the cost of this VPEVLBasedIVPHIRecipe.
3215+ InstructionCost computeCost (ElementCount VF,
3216+ VPCostContext &Ctx) const override {
3217+ // For now, match the behavior of the legacy cost model.
3218+ return 0 ;
3219+ }
3220+
31993221 // / Returns true if the recipe only uses the first lane of operand \p Op.
32003222 bool onlyFirstLaneUsed (const VPValue *Op) const override {
32013223 assert (is_contained (operands (), Op) &&
0 commit comments