llvm::InlineFunction

This function inlines the called function into the basic block of the caller. This returns false if it is not possible to inline this call. The program is still in a well defined state if this occurs though.

Synopsis

Declared in <llvm/Transforms/Utils/Cloning.h>

InlineResult
InlineFunction(
    CallBase& CB,
    InlineFunctionInfo& IFI,
    bool MergeAttributes = false,
    AAResults* CalleeAAR = nullptr,
    bool InsertLifetime = true,
    bool TrackInlineHistory = false,
    Function* ForwardVarArgsTo = nullptr,
    OptimizationRemarkEmitter* ORE = nullptr);

Description

Note that this only does one level of inlining. For example, if the instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now exists in the instruction stream. Similarly this will inline a recursive function by one level.

Note that while this routine is allowed to cleanup and optimize the inlined code to minimize the actual inserted code, it must not delete code in the caller as users of this routine may have pointers to instructions in the caller that need to remain stable.

If ForwardVarArgsTo is passed, inlining a function with varargs is allowed and all varargs at the callsite will be passed to any calls to ForwardVarArgsTo. The caller of InlineFunction has to make sure any varargs are only used by ForwardVarArgsTo.

The callee's function attributes are merged into the callers' if MergeAttributes is set to true.

Return Value

InlineResult is basically true or false. For false results the message describes a reason.

Parameters

NameDescription
CBBase class for all callable instructions (InvokeInst and CallInst) Holds everything related to calling a function.
IFIThis class captures the data input to the InlineFunction call, and records the auxiliary results produced by it.
OREThe optimization diagnostic interface.