mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 19:26:45 +00:00
[VPlan] Implement computeCost for remaining VPSingleDefRecipes.
Provide computeCost implementations for all remaining sub-classes of VPSingleDefRecipe. This pushes one of the last uses of getLegacyCost directly to its user: VPReplicateRecipe.
This commit is contained in:
parent
11df0ce140
commit
af6ebb70d2
@ -911,10 +911,6 @@ public:
|
||||
return cast<Instruction>(getUnderlyingValue());
|
||||
}
|
||||
|
||||
/// Return the cost of this VPSingleDefRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override;
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print this VPSingleDefRecipe to dbgs() (for debugging).
|
||||
LLVM_DUMP_METHOD void dump() const;
|
||||
@ -1323,6 +1319,13 @@ public:
|
||||
/// provided.
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPInstruction.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the VPInstruction to \p O.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -1605,6 +1608,13 @@ public:
|
||||
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPScalarCastRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
VPSlotTracker &SlotTracker) const override;
|
||||
@ -1872,6 +1882,13 @@ public:
|
||||
/// Generate the gep nodes.
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPWidenGEPRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -1906,6 +1923,13 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Return the cost of this VPVectorPointerRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Returns true if the recipe only uses the first part of operand \p Op.
|
||||
bool onlyFirstPartUsed(const VPValue *Op) const override {
|
||||
assert(is_contained(operands(), Op) &&
|
||||
@ -1961,6 +1985,13 @@ public:
|
||||
getDebugLoc());
|
||||
}
|
||||
|
||||
/// Return the cost of this VPHeaderPHIRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -2655,6 +2686,10 @@ public:
|
||||
/// the \p State.
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPReplicateRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override;
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -2767,6 +2802,13 @@ public:
|
||||
/// retain SSA form.
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPPredInstPHIRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -3046,6 +3088,13 @@ public:
|
||||
/// Generate a canonical vector induction variable of the vector loop, with
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPExpandSCEVRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -3221,6 +3270,13 @@ public:
|
||||
/// step = <VF*UF, VF*UF, ..., VF*UF>.
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPWidenCanonicalIVPHIRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -3265,6 +3321,13 @@ public:
|
||||
/// operand) + IV (2. operand) * StepValue (3, operand).
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPDerivedIVRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
@ -3320,6 +3383,13 @@ public:
|
||||
/// Generate the scalarized versions of the phi node as needed by their users.
|
||||
void execute(VPTransformState &State) override;
|
||||
|
||||
/// Return the cost of this VPScalarIVStepsRecipe.
|
||||
InstructionCost computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const override {
|
||||
// TODO: Compute accurate cost after retiring the legacy cost model.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
/// Print the recipe.
|
||||
void print(raw_ostream &O, const Twine &Indent,
|
||||
|
@ -292,18 +292,6 @@ InstructionCost VPRecipeBase::computeCost(ElementCount VF,
|
||||
llvm_unreachable("subclasses should implement computeCost");
|
||||
}
|
||||
|
||||
InstructionCost VPSingleDefRecipe::computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const {
|
||||
Instruction *UI = dyn_cast_or_null<Instruction>(getUnderlyingValue());
|
||||
if (isa<VPReplicateRecipe>(this)) {
|
||||
assert(UI && "VPReplicateRecipe must have an underlying instruction");
|
||||
// VPReplicateRecipe may be cloned as part of an existing VPlan-to-VPlan
|
||||
// transform, avoid computing their cost multiple times for now.
|
||||
Ctx.SkipCostComputation.insert(UI);
|
||||
}
|
||||
return UI ? Ctx.getLegacyCost(UI, VF) : 0;
|
||||
}
|
||||
|
||||
FastMathFlags VPRecipeWithIRFlags::getFastMathFlags() const {
|
||||
assert(OpType == OperationType::FPMathOp &&
|
||||
"recipe doesn't have fast math flags");
|
||||
@ -2283,6 +2271,15 @@ bool VPReplicateRecipe::shouldPack() const {
|
||||
});
|
||||
}
|
||||
|
||||
InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
|
||||
VPCostContext &Ctx) const {
|
||||
Instruction *UI = cast<Instruction>(getUnderlyingValue());
|
||||
// VPReplicateRecipe may be cloned as part of an existing VPlan-to-VPlan
|
||||
// transform, avoid computing their cost multiple times for now.
|
||||
Ctx.SkipCostComputation.insert(UI);
|
||||
return Ctx.getLegacyCost(UI, VF);
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
|
||||
VPSlotTracker &SlotTracker) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user