llvm::getAttributeBasedInliningDecision

Decide inlining from user directives and viability, without cost modeling.

Synopsis

Declared in <llvm/Analysis/InlineCost.h>

std::optional<InlineResult>
getAttributeBasedInliningDecision(
    CallBase& Call,
    Function* Callee,
    TargetTransformInfo& CalleeTTI,
    function_ref<TargetLibraryInfo const&(Function&)> GetTLI);

Description

Returns InlineResult::success() if the call site should be always inlined because of user directives, and the inlining is viable. Returns InlineResult::failure() if the inlining may never happen because of user directives or incompatibilities detectable without needing callee traversal. Otherwise returns std::nullopt, meaning that inlining should be decided based on other criteria (e.g. cost modeling).

Return Value

Always/never decision from directives, or std::nullopt to defer to cost modeling.

Parameters

NameDescription
CallCall site whose attributes are inspected.
CalleeCallee function, or null for an indirect call.
CalleeTTITarget transform info used to check inline compatibility.
GetTLICallback returning target library info for a function.