LLVM 22.0.0git
IndirectCallPromotion.cpp File Reference

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   "pgo-icall-prom"

Functions

 STATISTIC (NumOfPGOICallPromotion, "Number of indirect call promotions.")
 STATISTIC (NumOfPGOICallsites, "Number of indirect call candidate sites.")
static MDNodecreateBranchWeights (LLVMContext &Context, uint64_t TrueWeight, uint64_t FalseWeight)
static void computeVirtualCallSiteTypeInfoMap (Module &M, ModuleAnalysisManager &MAM, VirtualCallSiteTypeInfoMap &VirtualCSInfo)
static bool promoteIndirectCalls (Module &M, ProfileSummaryInfo *PSI, bool InLTO, bool SamplePGO, ModuleAnalysisManager &MAM)

Variables

cl::opt< unsignedMaxNumVTableAnnotations
static cl::opt< boolDisableICP ("disable-icp", cl::init(false), cl::Hidden, cl::desc("Disable indirect call promotion"))
static cl::opt< unsignedICPCutOff ("icp-cutoff", cl::init(0), cl::Hidden, cl::desc("Max number of promotions for this compilation"))
static cl::opt< unsignedICPCSSkip ("icp-csskip", cl::init(0), cl::Hidden, cl::desc("Skip Callsite up to this number for this compilation"))
static cl::opt< boolICPAllowDecls ("icp-allow-decls", cl::init(false), cl::Hidden, cl::desc("Promote the target candidate even when the defintion " " is not available"))
static cl::opt< boolICPAllowHotOnly ("icp-allow-hot-only", cl::init(true), cl::Hidden, cl::desc("Promote the target candidate only if it is a " "hot function. Otherwise, warm functions can " "also be promoted"))
static cl::opt< boolICPAllowCandidateSkip ("icp-allow-candidate-skip", cl::init(false), cl::Hidden, cl::desc("Continue with the remaining targets instead of exiting " "when failing in a candidate"))
static cl::opt< boolICPLTOMode ("icp-lto", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion in LTO " "mode"))
static cl::opt< boolICPSamplePGOMode ("icp-samplepgo", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion in SamplePGO mode"))
static cl::opt< boolICPCallOnly ("icp-call-only", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion for call instructions " "only"))
static cl::opt< boolICPInvokeOnly ("icp-invoke-only", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion for " "invoke instruction only"))
static cl::opt< boolICPDUMPAFTER ("icp-dumpafter", cl::init(false), cl::Hidden, cl::desc("Dump IR after transformation happens"))
static cl::opt< float > ICPVTablePercentageThreshold ("icp-vtable-percentage-threshold", cl::init(0.995), cl::Hidden, cl::desc("The percentage threshold of vtable-count / function-count for " "cost-benefit analysis."))
static cl::opt< int > ICPMaxNumVTableLastCandidate ("icp-max-num-vtable-last-candidate", cl::init(1), cl::Hidden, cl::desc("The maximum number of vtable for the last candidate."))
static cl::list< std::stringICPIgnoredBaseTypes ("icp-ignored-base-types", cl::Hidden, cl::desc("A list of mangled vtable type info names. Classes specified by the " "type info names and their derived ones will not be vtable-ICP'ed. " "Useful when the profiled types and actual types in the optimized " "binary could be different due to profiling limitations. Type info " "names are those string literals used in LLVM type metadata"))

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "pgo-icall-prom"

Definition at line 53 of file IndirectCallPromotion.cpp.

Function Documentation

◆ computeVirtualCallSiteTypeInfoMap()

◆ createBranchWeights()

MDNode * createBranchWeights ( LLVMContext & Context,
uint64_t TrueWeight,
uint64_t FalseWeight )
static

◆ promoteIndirectCalls()

◆ STATISTIC() [1/2]

STATISTIC ( NumOfPGOICallPromotion ,
"Number of indirect call promotions."  )

◆ STATISTIC() [2/2]

STATISTIC ( NumOfPGOICallsites ,
"Number of indirect call candidate sites."  )

Variable Documentation

◆ DisableICP

cl::opt< bool > DisableICP("disable-icp", cl::init(false), cl::Hidden, cl::desc("Disable indirect call promotion")) ( "disable-icp" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Disable indirect call promotion")  )
static

Referenced by promoteIndirectCalls().

◆ ICPAllowCandidateSkip

cl::opt< bool > ICPAllowCandidateSkip("icp-allow-candidate-skip", cl::init(false), cl::Hidden, cl::desc("Continue with the remaining targets instead of exiting " "when failing in a candidate")) ( "icp-allow-candidate-skip" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Continue with the remaining targets instead of exiting " "when failing in a candidate")  )
static

◆ ICPAllowDecls

cl::opt< bool > ICPAllowDecls("icp-allow-decls", cl::init(false), cl::Hidden, cl::desc("Promote the target candidate even when the defintion " " is not available")) ( "icp-allow-decls" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Promote the target candidate even when the defintion " " is not available")  )
static

◆ ICPAllowHotOnly

cl::opt< bool > ICPAllowHotOnly("icp-allow-hot-only", cl::init(true), cl::Hidden, cl::desc("Promote the target candidate only if it is a " "hot function. Otherwise, warm functions can " "also be promoted")) ( "icp-allow-hot-only" ,
cl::init(true) ,
cl::Hidden ,
cl::desc("Promote the target candidate only if it is a " "hot function. Otherwise, warm functions can " "also be promoted")  )
static

◆ ICPCallOnly

cl::opt< bool > ICPCallOnly("icp-call-only", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion for call instructions " "only")) ( "icp-call-only" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Run indirect-call promotion for call instructions " "only")  )
static

◆ ICPCSSkip

cl::opt< unsigned > ICPCSSkip("icp-csskip", cl::init(0), cl::Hidden, cl::desc("Skip Callsite up to this number for this compilation")) ( "icp-csskip" ,
cl::init(0) ,
cl::Hidden ,
cl::desc("Skip Callsite up to this number for this compilation")  )
static

◆ ICPCutOff

cl::opt< unsigned > ICPCutOff("icp-cutoff", cl::init(0), cl::Hidden, cl::desc("Max number of promotions for this compilation")) ( "icp-cutoff" ,
cl::init(0) ,
cl::Hidden ,
cl::desc("Max number of promotions for this compilation")  )
static

Referenced by promoteIndirectCalls().

◆ ICPDUMPAFTER

cl::opt< bool > ICPDUMPAFTER("icp-dumpafter", cl::init(false), cl::Hidden, cl::desc("Dump IR after transformation happens")) ( "icp-dumpafter" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Dump IR after transformation happens")  )
static

Referenced by promoteIndirectCalls().

◆ ICPIgnoredBaseTypes

cl::list< std::string > ICPIgnoredBaseTypes("icp-ignored-base-types", cl::Hidden, cl::desc( "A list of mangled vtable type info names. Classes specified by the " "type info names and their derived ones will not be vtable-ICP'ed. " "Useful when the profiled types and actual types in the optimized " "binary could be different due to profiling limitations. Type info " "names are those string literals used in LLVM type metadata")) ( "icp-ignored-base-types" ,
cl::Hidden ,
cl::desc( "A list of mangled vtable type info names. Classes specified by the " "type info names and their derived ones will not be vtable-ICP'ed. " "Useful when the profiled types and actual types in the optimized " "binary could be different due to profiling limitations. Type info " "names are those string literals used in LLVM type metadata")  )
static

Referenced by promoteIndirectCalls().

◆ ICPInvokeOnly

cl::opt< bool > ICPInvokeOnly("icp-invoke-only", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion for " "invoke instruction only")) ( "icp-invoke-only" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Run indirect-call promotion for " "invoke instruction only")  )
static

◆ ICPLTOMode

cl::opt< bool > ICPLTOMode("icp-lto", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion in LTO " "mode")) ( "icp-lto" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Run indirect-call promotion in LTO " "mode")  )
static

◆ ICPMaxNumVTableLastCandidate

cl::opt< int > ICPMaxNumVTableLastCandidate("icp-max-num-vtable-last-candidate", cl::init(1), cl::Hidden, cl::desc("The maximum number of vtable for the last candidate.")) ( "icp-max-num-vtable-last-candidate" ,
cl::init(1) ,
cl::Hidden ,
cl::desc("The maximum number of vtable for the last candidate.")  )
static

◆ ICPSamplePGOMode

cl::opt< bool > ICPSamplePGOMode("icp-samplepgo", cl::init(false), cl::Hidden, cl::desc("Run indirect-call promotion in SamplePGO mode")) ( "icp-samplepgo" ,
cl::init(false) ,
cl::Hidden ,
cl::desc("Run indirect-call promotion in SamplePGO mode")  )
static

◆ ICPVTablePercentageThreshold

cl::opt< float > ICPVTablePercentageThreshold("icp-vtable-percentage-threshold", cl::init(0.995), cl::Hidden, cl::desc("The percentage threshold of vtable-count / function-count for " "cost-benefit analysis.")) ( "icp-vtable-percentage-threshold" ,
cl::init(0.995) ,
cl::Hidden ,
cl::desc("The percentage threshold of vtable-count / function-count for " "cost-benefit analysis.")  )
static

◆ MaxNumVTableAnnotations

cl::opt<unsigned> MaxNumVTableAnnotations
extern