LLVM 20.0.0git
Namespaces | Macros | Functions | Variables
InlineAdvisor.cpp File Reference
#include "llvm/Analysis/InlineAdvisor.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InlineCost.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/ReplayInlineAdvisor.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/Utils/ImportedFunctionsInliningStatistics.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "inline"
 

Functions

 STATISTIC (NumCallerCallersAnalyzed, "Number of caller-callers analyzed")
 
static std::optional< llvm::InlineCostgetDefaultInlineAdvice (CallBase &CB, FunctionAnalysisManager &FAM, const InlineParams &Params)
 
static bool shouldBeDeferred (Function *Caller, TargetTransformInfo &CalleeTTI, InlineCost IC, int &TotalSecondaryCost, function_ref< InlineCost(CallBase &CB)> GetInlineCost)
 Return true if inlining of CB can block the caller from being inlined which is proved to be more beneficial.
 
static raw_ostreamllvm::operator<< (raw_ostream &R, const ore::NV &Arg)
 
template<class RemarkT >
RemarkT & llvm::operator<< (RemarkT &&R, const InlineCost &IC)
 
static const chargetLTOPhase (ThinOrFullLTOPhase LTOPhase)
 
static const chargetInlineAdvisorContext (InlinePass IP)
 

Variables

static cl::opt< boolInlineRemarkAttribute ("inline-remark-attribute", cl::init(false), cl::Hidden, cl::desc("Enable adding inline-remark attribute to" " callsites processed by inliner but decided" " to be not inlined"))
 Flag to add inline messages as callsite attributes 'inline-remark'.
 
static cl::opt< boolEnableInlineDeferral ("inline-deferral", cl::init(false), cl::Hidden, cl::desc("Enable deferred inlining"))
 
static cl::opt< int > InlineDeferralScale ("inline-deferral-scale", cl::desc("Scale to limit the cost of inline deferral"), cl::init(2), cl::Hidden)
 
static cl::opt< boolAnnotateInlinePhase ("annotate-inline-phase", cl::Hidden, cl::init(false), cl::desc("If true, annotate inline advisor remarks " "with LTO and pass information."))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "inline"

Definition at line 32 of file InlineAdvisor.cpp.

Function Documentation

◆ getDefaultInlineAdvice()

static std::optional< llvm::InlineCost > getDefaultInlineAdvice ( CallBase CB,
FunctionAnalysisManager FAM,
const InlineParams Params 
)
static

◆ getInlineAdvisorContext()

static const char * getInlineAdvisorContext ( InlinePass  IP)
inlinestatic

◆ getLTOPhase()

static const char * getLTOPhase ( ThinOrFullLTOPhase  LTOPhase)
inlinestatic

◆ shouldBeDeferred()

static bool shouldBeDeferred ( Function Caller,
TargetTransformInfo CalleeTTI,
InlineCost  IC,
int &  TotalSecondaryCost,
function_ref< InlineCost(CallBase &CB)>  GetInlineCost 
)
static

Return true if inlining of CB can block the caller from being inlined which is proved to be more beneficial.

IC is the estimated inline cost associated with callsite CB. TotalSecondaryCost will be set to the estimated cost of inlining the caller if CB is suppressed for inlining.

Definition at line 249 of file InlineAdvisor.cpp.

References llvm::CallBase::getCalledFunction(), llvm::InlineCost::getCost(), llvm::InlineCost::getCostDelta(), llvm::TargetTransformInfo::getInliningLastCallToStaticBonus(), InlineDeferralScale, and llvm::InlineCost::isAlways().

Referenced by llvm::shouldInline().

◆ STATISTIC()

STATISTIC ( NumCallerCallersAnalyzed  ,
"Number of caller-callers analyzed"   
)

Variable Documentation

◆ AnnotateInlinePhase

cl::opt< bool > AnnotateInlinePhase("annotate-inline-phase", cl::Hidden, cl::init(false), cl::desc("If true, annotate inline advisor remarks " "with LTO and pass information.")) ( "annotate-inline-phase"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("If true, annotate inline advisor remarks " "with LTO and pass information.")   
)
static

◆ EnableInlineDeferral

cl::opt< bool > EnableInlineDeferral("inline-deferral", cl::init(false), cl::Hidden, cl::desc("Enable deferred inlining")) ( "inline-deferral"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Enable deferred inlining")   
)
static

Referenced by getDefaultInlineAdvice().

◆ InlineDeferralScale

cl::opt< int > InlineDeferralScale("inline-deferral-scale", cl::desc("Scale to limit the cost of inline deferral"), cl::init(2), cl::Hidden) ( "inline-deferral-scale"  ,
cl::desc("Scale to limit the cost of inline deferral")  ,
cl::init(2)  ,
cl::Hidden   
)
static

Referenced by shouldBeDeferred().

◆ InlineRemarkAttribute

cl::opt< bool > InlineRemarkAttribute("inline-remark-attribute", cl::init(false), cl::Hidden, cl::desc("Enable adding inline-remark attribute to" " callsites processed by inliner but decided" " to be not inlined")) ( "inline-remark-attribute"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Enable adding inline-remark attribute to" " callsites processed by inliner but decided" " to be not inlined")   
)
static

Flag to add inline messages as callsite attributes 'inline-remark'.

Referenced by llvm::setInlineRemark().