@@ -219,29 +219,6 @@ class TargetTransformInfo {
219219 TCK_SizeAndLatency // /< The weighted sum of size and latency.
220220 };
221221
222- // / Query the cost of a specified instruction.
223- // /
224- // / Clients should use this interface to query the cost of an existing
225- // / instruction. The instruction must have a valid parent (basic block).
226- // /
227- // / Note, this method does not cache the cost calculation and it
228- // / can be expensive in some cases.
229- InstructionCost getInstructionCost (const Instruction *I,
230- enum TargetCostKind kind) const {
231- InstructionCost Cost;
232- switch (kind) {
233- case TCK_Latency:
234- Cost = getInstructionLatency (I);
235- break ;
236- case TCK_RecipThroughput:
237- case TCK_CodeSize:
238- case TCK_SizeAndLatency:
239- Cost = getUserCost (I, kind);
240- break ;
241- }
242- return Cost;
243- }
244-
245222 // / Underlying constants for 'cost' values in this interface.
246223 // /
247224 // / Many APIs in this interface return a cost. This enum defines the
@@ -320,14 +297,16 @@ class TargetTransformInfo {
320297 // /
321298 // / The returned cost is defined in terms of \c TargetCostConstants, see its
322299 // / comments for a detailed explanation of the cost values.
323- InstructionCost getUserCost (const User *U, ArrayRef<const Value *> Operands,
324- TargetCostKind CostKind) const ;
300+ InstructionCost getInstructionCost (const User *U,
301+ ArrayRef<const Value *> Operands,
302+ TargetCostKind CostKind) const ;
325303
326- // / This is a helper function which calls the two-argument getUserCost
327- // / with \p Operands which are the current operands U has.
328- InstructionCost getUserCost (const User *U, TargetCostKind CostKind) const {
304+ // / This is a helper function which calls the three-argument
305+ // / getInstructionCost with \p Operands which are the current operands U has.
306+ InstructionCost getInstructionCost (const User *U,
307+ TargetCostKind CostKind) const {
329308 SmallVector<const Value *, 4 > Operands (U->operand_values ());
330- return getUserCost (U, Operands, CostKind);
309+ return getInstructionCost (U, Operands, CostKind);
331310 }
332311
333312 // / If a branch or a select condition is skewed in one direction by more than
@@ -432,11 +411,11 @@ class TargetTransformInfo {
432411 // / Parameters that control the generic loop unrolling transformation.
433412 struct UnrollingPreferences {
434413 // / The cost threshold for the unrolled loop. Should be relative to the
435- // / getUserCost values returned by this API, and the expectation is that
436- // / the unrolled loop's instructions when run through that interface should
437- // / not exceed this cost. However, this is only an estimate. Also, specific
438- // / loops may be unrolled even with a cost above this threshold if deemed
439- // / profitable. Set this to UINT_MAX to disable the loop body cost
414+ // / getInstructionCost values returned by this API, and the expectation is
415+ // / that the unrolled loop's instructions when run through that interface
416+ // / should not exceed this cost. However, this is only an estimate. Also,
417+ // / specific loops may be unrolled even with a cost above this threshold if
418+ // / deemed profitable. Set this to UINT_MAX to disable the loop body cost
440419 // / restriction.
441420 unsigned Threshold;
442421 // / If complete unrolling will reduce the cost of the loop, we will boost
@@ -1519,10 +1498,6 @@ class TargetTransformInfo {
15191498 // / @}
15201499
15211500private:
1522- // / Estimate the latency of specified instruction.
1523- // / Returns 1 as the default value.
1524- InstructionCost getInstructionLatency (const Instruction *I) const ;
1525-
15261501 // / The abstract base class used to type erase specific TTI
15271502 // / implementations.
15281503 class Concept ;
@@ -1549,9 +1524,9 @@ class TargetTransformInfo::Concept {
15491524 getEstimatedNumberOfCaseClusters (const SwitchInst &SI, unsigned &JTSize,
15501525 ProfileSummaryInfo *PSI,
15511526 BlockFrequencyInfo *BFI) = 0 ;
1552- virtual InstructionCost getUserCost (const User *U,
1553- ArrayRef<const Value *> Operands,
1554- TargetCostKind CostKind) = 0;
1527+ virtual InstructionCost getInstructionCost (const User *U,
1528+ ArrayRef<const Value *> Operands,
1529+ TargetCostKind CostKind) = 0;
15551530 virtual BranchProbability getPredictableBranchThreshold () = 0;
15561531 virtual bool hasBranchDivergence () = 0;
15571532 virtual bool useGPUDivergenceAnalysis () = 0;
@@ -1866,7 +1841,6 @@ class TargetTransformInfo::Concept {
18661841 virtual bool supportsScalableVectors () const = 0;
18671842 virtual bool hasActiveVectorLength (unsigned Opcode, Type *DataType,
18681843 Align Alignment) const = 0;
1869- virtual InstructionCost getInstructionLatency (const Instruction *I) = 0;
18701844 virtual VPLegalization
18711845 getVPLegalizationStrategy (const VPIntrinsic &PI) const = 0 ;
18721846};
@@ -1901,9 +1875,10 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
19011875 InstructionCost getMemcpyCost (const Instruction *I) override {
19021876 return Impl.getMemcpyCost (I);
19031877 }
1904- InstructionCost getUserCost (const User *U, ArrayRef<const Value *> Operands,
1905- TargetCostKind CostKind) override {
1906- return Impl.getUserCost (U, Operands, CostKind);
1878+ InstructionCost getInstructionCost (const User *U,
1879+ ArrayRef<const Value *> Operands,
1880+ TargetCostKind CostKind) override {
1881+ return Impl.getInstructionCost (U, Operands, CostKind);
19071882 }
19081883 BranchProbability getPredictableBranchThreshold () override {
19091884 return Impl.getPredictableBranchThreshold ();
@@ -2518,10 +2493,6 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
25182493 return Impl.hasActiveVectorLength (Opcode, DataType, Alignment);
25192494 }
25202495
2521- InstructionCost getInstructionLatency (const Instruction *I) override {
2522- return Impl.getInstructionLatency (I);
2523- }
2524-
25252496 VPLegalization
25262497 getVPLegalizationStrategy (const VPIntrinsic &PI) const override {
25272498 return Impl.getVPLegalizationStrategy (PI);
0 commit comments