Represents the cost of inlining a function.

Synopsis

Declared in <llvm/Analysis/InlineCost.h>

class InlineCost;

Description

This supports special values for functions which should "always" or "never" be inlined. Otherwise, the cost represents a unitless amount; smaller values increase the likelihood of the function being inlined.

Objects of this type also provide the adjusted threshold for inlining based on the information available for a particular callsite. They can be directly tested to determine if inlining should occur given the cost and threshold for this cost metric.

Member Functions

Name

Description

getCost

Get the inline cost estimate. It is an error to call this on an "always" or "never" InlineCost.

getCostBenefit

Get the cost‐benefit pair which was computed by cost‐benefit analysis

getCostDelta

Get the cost delta from the threshold for inlining. Only valid if the cost is of the variable kind. Returns a negative value if the cost is too high to inline.

getReason

Get the reason of Always or Never.

getStaticBonusApplied

Get the amount of StaticBonus applied.

getThreshold

Get the threshold against which the cost was computed

isAlways

Return true if this cost is the always‐inline sentinel.

isNever

Return true if this cost is the never‐inline sentinel.

isVariable

Return true if this cost is a finite estimate rather than a sentinel.

operator bool

Test whether the inline cost is low enough for inlining.

Static Member Functions

Name

Description

get

Create an InlineCost with a variable cost and threshold.

getAlways

Create an InlineCost that always recommends inlining.

getNever

Create an InlineCost that never recommends inlining.

Non-Member Functions

Name

Description

getInlineCost

Get an InlineCost object representing the cost of inlining this callsite.

getInlineCost

Get an InlineCost with the callee explicitly specified.

inlineCostStr

Utility for extracting the inline cost message to a string.

shouldInline

Return the inline cost when the inliner should attempt CB, else nullopt.

Created with MrDocs