Go to the source code of this file.
Namespaces
namespace
llvm
This is an optimization pass for GlobalISel generic memory operations.
Functions
STATISTIC (NumOfMemProfMissing, "Number of functions without memory profile.")
STATISTIC (NumOfMemProfMismatch, "Number of functions having mismatched memory profile hash.")
STATISTIC (NumOfMemProfFunc, "Number of functions having valid memory profile.")
STATISTIC (NumOfMemProfAllocContextProfiles, "Number of alloc contexts in memory profile.")
STATISTIC (NumOfMemProfCallSiteProfiles, "Number of callsites in memory profile.")
STATISTIC (NumOfMemProfMatchedAllocContexts, "Number of matched memory profile alloc contexts.")
STATISTIC (NumOfMemProfMatchedAllocs, "Number of matched memory profile allocs.")
STATISTIC (NumOfMemProfMatchedCallSites, "Number of matched memory profile callsites.")
STATISTIC (NumOfMemProfHotGlobalVars, "Number of global vars annotated with 'hot' section prefix.")
STATISTIC (NumOfMemProfColdGlobalVars, "Number of global vars annotated with 'unlikely' section prefix.")
STATISTIC (NumOfMemProfUnknownGlobalVars, "Number of global vars with unknown hotness (no section prefix).")
STATISTIC (NumOfMemProfExplicitSectionGlobalVars, "Number of global vars with user-specified section (not annotated).")
static void
addCallsiteMetadata (Instruction &I , ArrayRef < uint64_t > InlinedCallStack, LLVMContext &Ctx)
static uint64_t
computeStackId (GlobalValue::GUID Function , uint32_t LineOffset, uint32_t Column)
static uint64_t
computeStackId (const memprof::Frame &Frame )
static AllocationType
getAllocType (const AllocationInfo *AllocInfo )
static AllocationType
addCallStack (CallStackTrie &AllocTrie, const AllocationInfo *AllocInfo , uint64_t FullStackId)
static bool
stackFrameIncludesInlinedCallStack (ArrayRef < Frame > ProfileCallStack, ArrayRef < uint64_t > InlinedCallStack)
static bool
isAllocationWithHotColdVariant (const Function *Callee, const TargetLibraryInfo &TLI)
static void
HandleUnsupportedAnnotationKinds (GlobalVariable &GVar, AnnotationKind Kind)
static void
undriftMemProfRecord (const DenseMap < uint64_t , LocToLocMap > &UndriftMaps, memprof::MemProfRecord &MemProfRec)
static void
addVPMetadata (Module &M, Instruction &I , ArrayRef < GlobalValue::GUID > CalleeGuids)
static void
handleAllocSite (Instruction &I , CallBase *CI, ArrayRef < uint64_t > InlinedCallStack, LLVMContext &Ctx, OptimizationRemarkEmitter &ORE, uint64_t MaxColdSize, const std::set< const AllocationInfo * > &AllocInfoSet, std::map< std::pair< uint64_t , unsigned >, AllocMatchInfo > &FullStackIdToAllocMatchInfo)
static void
handleCallSite (Instruction &I , const Function *CalledFunction, ArrayRef < uint64_t > InlinedCallStack, const std::unordered_set< CallSiteEntry , CallSiteEntryHash > &CallSiteEntries, Module &M, std::set< std::vector< uint64_t > > &MatchedCallSites, OptimizationRemarkEmitter &ORE)
static void
readMemprof (Module &M, Function &F , IndexedInstrProfReader *MemProfReader , const TargetLibraryInfo &TLI, std::map< std::pair< uint64_t , unsigned >, AllocMatchInfo > &FullStackIdToAllocMatchInfo, std::set< std::vector< uint64_t > > &MatchedCallSites, DenseMap < uint64_t , LocToLocMap > &UndriftMaps, OptimizationRemarkEmitter &ORE, uint64_t MaxColdSize)
Variables
cl::opt < bool >
llvm::PGOWarnMissing
cl::opt < bool >
llvm::NoPGOWarnMismatchComdatWeak
static cl::opt < bool >
ClMemProfMatchHotColdNew ("memprof-match-hot-cold-new", cl::desc ("Match allocation profiles onto existing hot/cold operator new calls"), cl::Hidden, cl::init(false))
static cl::opt < bool >
ClPrintMemProfMatchInfo ("memprof-print -match-info", cl::desc ("Print matching stats for each allocation " "context in this module's profiles"), cl::Hidden, cl::init(false))
static cl::opt < bool >
PrintFunctionGuids ("memprof-print -function -guids", cl::desc ("Print function GUIDs computed for matching"), cl::Hidden, cl::init(false))
static cl::opt < bool >
SalvageStaleProfile ("memprof-salvage-stale-profile", cl::desc ("Salvage stale MemProf profile"), cl::init(false), cl::Hidden)
static cl::opt < bool >
ClMemProfAttachCalleeGuids ("memprof-attach-calleeguids", cl::desc ("Attach calleeguids as value profile metadata for indirect calls."), cl::init(true), cl::Hidden)
static cl::opt < unsigned >
MinMatchedColdBytePercent ("memprof-matching-cold-threshold", cl::init(100), cl::Hidden, cl::desc ("Min percent of cold bytes matched to hint allocation cold"))
static cl::opt < bool >
AnnotateStaticDataSectionPrefix ("memprof-annotate-static-data -prefix", cl::init(false), cl::Hidden, cl::desc ("If true, annotate the static data section prefix"))
◆ DEBUG_TYPE#define DEBUG_TYPE "memprof"
◆ addCallStack()Definition at line 371 of file MemProfUse.cpp .
References llvm::annotateValueSite() , ClMemProfAttachCalleeGuids , llvm::ArrayRef< T >::empty() , llvm::SmallVectorTemplateCommon< T, typename >::empty() , llvm::getValueProfDataFromInst() , I , llvm::SmallVectorTemplateBase< T, bool >::push_back() , and llvm::SmallVectorTemplateCommon< T, typename >::size() .
Referenced by handleCallSite() .
◆ computeStackId() [1/2]◆ computeStackId() [2/2]◆ getAllocType()◆ handleAllocSite()Definition at line 411 of file MemProfUse.cpp .
References addCallsiteMetadata() , addCallStack() , llvm::memprof::CallStackTrie::addSingleAllocTypeAttribute() , assert() , llvm::memprof::CallStackTrie::buildAndAttachMIBMetadata() , ClPrintMemProfMatchInfo , llvm::Cold , llvm::memprof::computeFullStackId() , DEBUG_TYPE , llvm::OptimizationRemarkEmitter::emit() , llvm::memprof::CallStackTrie::empty() , llvm::memprof::getAllocType() , llvm::memprof::getAllocTypeAttributeString() , llvm::Instruction::getFunction() , I , llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert() , MinMatchedColdBytePercent , llvm::NotCold , llvm::ArrayRef< T >::size() , and stackFrameIncludesInlinedCallStack() .
Referenced by readMemprof() .
◆ handleCallSite()Definition at line 529 of file MemProfUse.cpp .
References addCallsiteMetadata() , addVPMetadata() , llvm::append_range() , CallSiteEntry::CalleeGuids , ClPrintMemProfMatchInfo , DEBUG_TYPE , llvm::OptimizationRemarkEmitter::emit() , CallSiteEntry::Frames , I , llvm::ArrayRef< T >::size() , and stackFrameIncludesInlinedCallStack() .
Referenced by readMemprof() .
◆ HandleUnsupportedAnnotationKinds()◆ isAllocationWithHotColdVariant()◆ readMemprof()
void readMemprof ( Module & M , Function & F , IndexedInstrProfReader * MemProfReader , const TargetLibraryInfo & TLI , std::map< std::pair< uint64_t , unsigned >, AllocMatchInfo > & FullStackIdToAllocMatchInfo , std::set< std::vector< uint64_t > > & MatchedCallSites , DenseMap < uint64_t , LocToLocMap > & UndriftMaps , OptimizationRemarkEmitter & ORE , uint64_t MaxColdSize )
static
Definition at line 567 of file MemProfUse.cpp .
References llvm::ArrayRef() , assert() , llvm::GlobalValue::AvailableExternallyLinkage , computeStackId() , llvm::dbgs() , llvm::ArrayRef< T >::drop_front() , llvm::DS_Warning , llvm::dyn_cast() , llvm::SmallVectorTemplateCommon< T, typename >::end() , llvm::errs() , F , llvm::InstrProfError::get() , llvm::GlobalValue::getGUIDAssumingExternalLinkage() , llvm::handleAllErrors() , handleAllocSite() , handleCallSite() , llvm::hash_mismatch , I , isAllocationWithHotColdVariant() , LLVM_DEBUG , llvm::InstrProfError::message() , llvm::NoPGOWarnMismatch , llvm::NoPGOWarnMismatchComdatWeak , llvm::PGOWarnMissing , PrintFunctionGuids , llvm::SmallVectorTemplateBase< T, bool >::push_back() , SalvageStaleProfile , undriftMemProfRecord() , and llvm::unknown_function .
Referenced by llvm::MemProfUsePass::run() .
◆ stackFrameIncludesInlinedCallStack()◆ STATISTIC() [1/12]
STATISTIC
(
NumOfMemProfAllocContextProfiles
,
"Number of alloc contexts in memory profile."
)
◆ STATISTIC() [2/12]
STATISTIC
(
NumOfMemProfCallSiteProfiles
,
"Number of callsites in memory profile."
)
◆ STATISTIC() [3/12]
STATISTIC
(
NumOfMemProfColdGlobalVars
,
"Number of global vars annotated with 'unlikely' section prefix."
)
◆ STATISTIC() [4/12]
STATISTIC
(
NumOfMemProfExplicitSectionGlobalVars
,
"Number of global vars with user-specified section (not annotated)."
)
◆ STATISTIC() [5/12]
STATISTIC
(
NumOfMemProfFunc
,
"Number of functions having valid memory profile."
)
◆ STATISTIC() [6/12]
STATISTIC
(
NumOfMemProfHotGlobalVars
,
"Number of global vars annotated with 'hot' section prefix."
)
◆ STATISTIC() [7/12]
STATISTIC
(
NumOfMemProfMatchedAllocContexts
,
"Number of matched memory profile alloc contexts."
)
◆ STATISTIC() [8/12]
STATISTIC
(
NumOfMemProfMatchedAllocs
,
"Number of matched memory profile allocs."
)
◆ STATISTIC() [9/12]
STATISTIC
(
NumOfMemProfMatchedCallSites
,
"Number of matched memory profile callsites."
)
◆ STATISTIC() [10/12]
STATISTIC
(
NumOfMemProfMismatch
,
"Number of functions having mismatched memory profile hash."
)
◆ STATISTIC() [11/12]
STATISTIC
(
NumOfMemProfMissing
,
"Number of functions without memory profile."
)
◆ STATISTIC() [12/12]
STATISTIC
(
NumOfMemProfUnknownGlobalVars
,
"Number of global vars with unknown hotness (no section prefix)."
)
◆ undriftMemProfRecord()Definition at line 346 of file MemProfUse.cpp .
References llvm::memprof::MemProfRecord::AllocSites , llvm::memprof::MemProfRecord::CallSites , llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end() , F , llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find() , and I .
Referenced by readMemprof() .
◆ AnnotateStaticDataSectionPrefix
cl::opt < bool > AnnotateStaticDataSectionPrefix("memprof-annotate-static-data -prefix", cl::init(false), cl::Hidden, cl::desc ("If true, annotate the static data section prefix")) ( "memprof-annotate-static-data -prefix" , cl::init(false) , cl::Hidden , cl::desc ("If true, annotate the static data section prefix") )
static
◆ ClMemProfAttachCalleeGuids
cl::opt < bool > ClMemProfAttachCalleeGuids("memprof-attach-calleeguids", cl::desc ( "Attach calleeguids as value profile metadata for indirect calls."), cl::init(true), cl::Hidden) ( "memprof-attach-calleeguids" , cl::desc ( "Attach calleeguids as value profile metadata for indirect calls.") , cl::init(true) , cl::Hidden )
static
◆ ClMemProfMatchHotColdNew
cl::opt < bool > ClMemProfMatchHotColdNew("memprof-match-hot-cold-new", cl::desc ( "Match allocation profiles onto existing hot/cold operator new calls"), cl::Hidden, cl::init(false)) ( "memprof-match-hot-cold-new" , cl::desc ( "Match allocation profiles onto existing hot/cold operator new calls") , cl::Hidden , cl::init(false) )
static
◆ ClPrintMemProfMatchInfo
cl::opt < bool > ClPrintMemProfMatchInfo("memprof-print -match-info", cl::desc ("Print matching stats for each allocation " "context in this module's profiles"), cl::Hidden, cl::init(false)) ( "memprof-print -match-info" , cl::desc ("Print matching stats for each allocation " "context in this module's profiles") , cl::Hidden , cl::init(false) )
static
◆ MinMatchedColdBytePercent
cl::opt < unsigned > MinMatchedColdBytePercent("memprof-matching-cold-threshold", cl::init(100), cl::Hidden, cl::desc ("Min percent of cold bytes matched to hint allocation cold")) ( "memprof-matching-cold-threshold" , cl::init(100) , cl::Hidden , cl::desc ("Min percent of cold bytes matched to hint allocation cold") )
static
◆ PrintFunctionGuids◆ SalvageStaleProfile
cl::opt < bool > SalvageStaleProfile("memprof-salvage-stale-profile", cl::desc ("Salvage stale MemProf profile"), cl::init(false), cl::Hidden) ( "memprof-salvage-stale-profile" , cl::desc ("Salvage stale MemProf profile") , cl::init(false) , cl::Hidden )
static