llvm::getInliningCostEstimate

Get the cost estimate ignoring thresholds.

Synopsis

Declared in <llvm/Analysis/InlineCost.h>

std::optional<int>
getInliningCostEstimate(
    CallBase& Call,
    TargetTransformInfo& CalleeTTI,
    function_ref<AssumptionCache&(Function&)> GetAssumptionCache,
    function_ref<BlockFrequencyInfo&(Function&)> GetBFI = nullptr,
    function_ref<TargetLibraryInfo const&(Function&)> GetTLI = nullptr,
    ProfileSummaryInfo* PSI = nullptr,
    OptimizationRemarkEmitter* ORE = nullptr);

Description

This is similar to getInlineCost when passed InlineParams::ComputeFullInlineCost, or a non-null ORE. It uses default InlineParams otherwise. Contrary to getInlineCost, which makes a threshold-based final evaluation of should/shouldn't inline, captured in InlineResult, getInliningCostEstimate returns:

  • std::nullopt, if the inlining cannot happen (is illegal)

  • an integer, representing the cost.

Return Value

The estimated cost, or std::nullopt if inlining is illegal.

Parameters

NameDescription
CallCall site whose inlining cost is estimated.
CalleeTTITarget transform info for the callee.
GetAssumptionCacheCallback returning the assumption cache for a function.
GetBFIOptional callback returning block frequency info, or null.
GetTLIOptional callback returning target library info, or null.
PSIOptional profile summary used for hot/cold callsite thresholds.
OREOptional remark emitter for inlining diagnostics.