LLVM  14.0.0git
Macros | Functions | Variables
InlineCost.cpp File Reference
#include "llvm/Analysis/InlineCost.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/CodeMetrics.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/raw_ostream.h"
Include dependency graph for InlineCost.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "inline-cost"
 
#define DEBUG_PRINT_STAT(x)   dbgs() << " " #x ": " << x << "\n"
 

Functions

 STATISTIC (NumCallsAnalyzed, "Number of call sites analyzed")
 
static bool functionsHaveCompatibleAttributes (Function *Caller, Function *Callee, TargetTransformInfo &TTI, function_ref< const TargetLibraryInfo &(Function &)> &GetTLI)
 Test that there are no attribute conflicts between Caller and Callee that prevent inlining. More...
 
static int computeThresholdFromOptLevels (unsigned OptLevel, unsigned SizeOptLevel)
 

Variables

static cl::opt< intDefaultThreshold ("inlinedefault-threshold", cl::Hidden, cl::init(225), cl::ZeroOrMore, cl::desc("Default amount of inlining to perform"))
 
static cl::opt< bool > PrintInstructionComments ("print-instruction-comments", cl::Hidden, cl::init(false), cl::desc("Prints comments for instruction based on inline cost analysis"))
 
static cl::opt< intInlineThreshold ("inline-threshold", cl::Hidden, cl::init(225), cl::ZeroOrMore, cl::desc("Control the amount of inlining to perform (default = 225)"))
 
static cl::opt< intHintThreshold ("inlinehint-threshold", cl::Hidden, cl::init(325), cl::ZeroOrMore, cl::desc("Threshold for inlining functions with inline hint"))
 
static cl::opt< intColdCallSiteThreshold ("inline-cold-callsite-threshold", cl::Hidden, cl::init(45), cl::ZeroOrMore, cl::desc("Threshold for inlining cold callsites"))
 
static cl::opt< bool > InlineEnableCostBenefitAnalysis ("inline-enable-cost-benefit-analysis", cl::Hidden, cl::init(false), cl::desc("Enable the cost-benefit analysis for the inliner"))
 
static cl::opt< intInlineSavingsMultiplier ("inline-savings-multiplier", cl::Hidden, cl::init(8), cl::ZeroOrMore, cl::desc("Multiplier to multiply cycle savings by during inlining"))
 
static cl::opt< intInlineSizeAllowance ("inline-size-allowance", cl::Hidden, cl::init(100), cl::ZeroOrMore, cl::desc("The maximum size of a callee that get's " "inlined without sufficient cycle savings"))
 
static cl::opt< intColdThreshold ("inlinecold-threshold", cl::Hidden, cl::init(45), cl::ZeroOrMore, cl::desc("Threshold for inlining functions with cold attribute"))
 
static cl::opt< intHotCallSiteThreshold ("hot-callsite-threshold", cl::Hidden, cl::init(3000), cl::ZeroOrMore, cl::desc("Threshold for hot callsites "))
 
static cl::opt< intLocallyHotCallSiteThreshold ("locally-hot-callsite-threshold", cl::Hidden, cl::init(525), cl::ZeroOrMore, cl::desc("Threshold for locally hot callsites "))
 
static cl::opt< intColdCallSiteRelFreq ("cold-callsite-rel-freq", cl::Hidden, cl::init(2), cl::ZeroOrMore, cl::desc("Maximum block frequency, expressed as a percentage of caller's " "entry frequency, for a callsite to be cold in the absence of " "profile information."))
 
static cl::opt< intHotCallSiteRelFreq ("hot-callsite-rel-freq", cl::Hidden, cl::init(60), cl::ZeroOrMore, cl::desc("Minimum block frequency, expressed as a multiple of caller's " "entry frequency, for a callsite to be hot in the absence of " "profile information."))
 
static cl::opt< intCallPenalty ("inline-call-penalty", cl::Hidden, cl::init(25), cl::desc("Call penalty that is applied per callsite when inlining"))
 
static cl::opt< bool > OptComputeFullInlineCost ("inline-cost-full", cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::desc("Compute the full inline cost of a call site even when the cost " "exceeds the threshold."))
 
static cl::opt< bool > InlineCallerSupersetNoBuiltin ("inline-caller-superset-nobuiltin", cl::Hidden, cl::init(true), cl::ZeroOrMore, cl::desc("Allow inlining when caller has a superset of callee's nobuiltin " "attributes."))
 
static cl::opt< bool > DisableGEPConstOperand ("disable-gep-const-evaluation", cl::Hidden, cl::init(false), cl::desc("Disables evaluation of GetElementPtr with constant operands"))
 

Macro Definition Documentation

◆ DEBUG_PRINT_STAT

#define DEBUG_PRINT_STAT (   x)    dbgs() << " " #x ": " << x << "\n"

◆ DEBUG_TYPE

#define DEBUG_TYPE   "inline-cost"

Definition at line 48 of file InlineCost.cpp.

Function Documentation

◆ computeThresholdFromOptLevels()

static int computeThresholdFromOptLevels ( unsigned  OptLevel,
unsigned  SizeOptLevel 
)
static

◆ functionsHaveCompatibleAttributes()

static bool functionsHaveCompatibleAttributes ( Function Caller,
Function Callee,
TargetTransformInfo TTI,
function_ref< const TargetLibraryInfo &(Function &)> &  GetTLI 
)
static

Test that there are no attribute conflicts between Caller and Callee that prevent inlining.

Definition at line 2706 of file InlineCost.cpp.

References llvm::AttributeFuncs::areInlineCompatible(), llvm::TargetTransformInfo::areInlineCompatible(), Callee, and InlineCallerSupersetNoBuiltin.

Referenced by llvm::getAttributeBasedInliningDecision().

◆ STATISTIC()

STATISTIC ( NumCallsAnalyzed  ,
"Number of call sites analyzed"   
)

Variable Documentation

◆ CallPenalty

cl::opt<int> CallPenalty("inline-call-penalty", cl::Hidden, cl::init(25), cl::desc("Call penalty that is applied per callsite when inlining"))
static

Referenced by llvm::getCallsiteCost().

◆ ColdCallSiteRelFreq

cl::opt<int> ColdCallSiteRelFreq("cold-callsite-rel-freq", cl::Hidden, cl::init(2), cl::ZeroOrMore, cl::desc("Maximum block frequency, expressed as a percentage of caller's " "entry frequency, for a callsite to be cold in the absence of " "profile information."))
static

◆ ColdCallSiteThreshold

cl::opt<int> ColdCallSiteThreshold("inline-cold-callsite-threshold", cl::Hidden, cl::init(45), cl::ZeroOrMore, cl::desc("Threshold for inlining cold callsites"))
static

Referenced by llvm::getInlineParams().

◆ ColdThreshold

cl::opt<int> ColdThreshold("inlinecold-threshold", cl::Hidden, cl::init(45), cl::ZeroOrMore, cl::desc("Threshold for inlining functions with cold attribute"))
static

Referenced by llvm::getInlineParams().

◆ DefaultThreshold

cl::opt<int> DefaultThreshold("inlinedefault-threshold", cl::Hidden, cl::init(225), cl::ZeroOrMore, cl::desc("Default amount of inlining to perform"))
static

◆ DisableGEPConstOperand

cl::opt<bool> DisableGEPConstOperand("disable-gep-const-evaluation", cl::Hidden, cl::init(false), cl::desc("Disables evaluation of GetElementPtr with constant operands"))
static

◆ HintThreshold

cl::opt<int> HintThreshold("inlinehint-threshold", cl::Hidden, cl::init(325), cl::ZeroOrMore, cl::desc("Threshold for inlining functions with inline hint"))
static

Referenced by llvm::getInlineParams().

◆ HotCallSiteRelFreq

cl::opt<int> HotCallSiteRelFreq("hot-callsite-rel-freq", cl::Hidden, cl::init(60), cl::ZeroOrMore, cl::desc("Minimum block frequency, expressed as a multiple of caller's " "entry frequency, for a callsite to be hot in the absence of " "profile information."))
static

◆ HotCallSiteThreshold

cl::opt<int> HotCallSiteThreshold("hot-callsite-threshold", cl::Hidden, cl::init(3000), cl::ZeroOrMore, cl::desc("Threshold for hot callsites "))
static

Referenced by llvm::getInlineParams().

◆ InlineCallerSupersetNoBuiltin

cl::opt<bool> InlineCallerSupersetNoBuiltin("inline-caller-superset-nobuiltin", cl::Hidden, cl::init(true), cl::ZeroOrMore, cl::desc("Allow inlining when caller has a superset of callee's nobuiltin " "attributes."))
static

◆ InlineEnableCostBenefitAnalysis

cl::opt<bool> InlineEnableCostBenefitAnalysis("inline-enable-cost-benefit-analysis", cl::Hidden, cl::init(false), cl::desc("Enable the cost-benefit analysis for the inliner"))
static

◆ InlineSavingsMultiplier

cl::opt<int> InlineSavingsMultiplier("inline-savings-multiplier", cl::Hidden, cl::init(8), cl::ZeroOrMore, cl::desc("Multiplier to multiply cycle savings by during inlining"))
static

◆ InlineSizeAllowance

cl::opt<int> InlineSizeAllowance("inline-size-allowance", cl::Hidden, cl::init(100), cl::ZeroOrMore, cl::desc("The maximum size of a callee that get's " "inlined without sufficient cycle savings"))
static

◆ InlineThreshold

cl::opt<int> InlineThreshold("inline-threshold", cl::Hidden, cl::init(225), cl::ZeroOrMore, cl::desc("Control the amount of inlining to perform (default = 225)"))
static

Referenced by llvm::getInlineParams().

◆ LocallyHotCallSiteThreshold

cl::opt<int> LocallyHotCallSiteThreshold("locally-hot-callsite-threshold", cl::Hidden, cl::init(525), cl::ZeroOrMore, cl::desc("Threshold for locally hot callsites "))
static

Referenced by llvm::getInlineParams().

◆ OptComputeFullInlineCost

cl::opt<bool> OptComputeFullInlineCost("inline-cost-full", cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::desc("Compute the full inline cost of a call site even when the cost " "exceeds the threshold."))
static

◆ PrintInstructionComments

cl::opt<bool> PrintInstructionComments("print-instruction-comments", cl::Hidden, cl::init(false), cl::desc("Prints comments for instruction based on inline cost analysis"))
static