LLVM 24.0.0git
MemProfUse.cpp File Reference

Go to the source code of this file.

Classes

struct  AllocMatchInfo
struct  CallSiteEntry

Namespaces

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

Macros

#define DEBUG_TYPE   "memprof"

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 uint32_t getLineOffset (const DILocation *DIL)
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 InstrumentationOptions &Opts, const Function *Callee, const TargetLibraryInfo &TLI)
static void HandleUnsupportedAnnotationKinds (GlobalVariable &GVar, AnnotationKind Kind)
static std::optional< uint64_t > getStringContentHash (const GlobalVariable &GVar)
static void undriftMemProfRecord (const DenseMap< uint64_t, LocToLocMap > &UndriftMaps, memprof::MemProfRecord &MemProfRec)
static void addVPMetadata (const InstrumentationOptions &Opts, Module &M, Instruction &I, ArrayRef< GlobalValue::GUID > CalleeGuids)
static void handleAllocSite (const InstrumentationOptions &Opts, Instruction &I, CallBase *CI, ArrayRef< uint64_t > InlinedCallStack, LLVMContext &Ctx, OptimizationRemarkEmitter &ORE, uint64_t MaxColdSize, const std::set< const AllocationInfo * > &AllocInfoSet, std::map< uint64_t, AllocMatchInfo > &FullStackIdToAllocMatchInfo)
static void handleCallSite (const InstrumentationOptions &Opts, Instruction &I, const Function *CalledFunction, ArrayRef< uint64_t > InlinedCallStack, const std::vector< CallSiteEntry > &CallSiteEntries, Module &M, std::set< std::vector< uint64_t > > &MatchedCallSites, OptimizationRemarkEmitter &ORE)
static void dumpInlineCallStack (Instruction &I, CallBase *CI, OptimizationRemarkEmitter &ORE, DenseSet< uint64_t > &SeenFrames, DenseSet< uint64_t > &SeenStacks, bool ProfileHasColumns)
static void readMemprof (const InstrumentationOptions &Opts, Module &M, Function &F, IndexedInstrProfReader *MemProfReader, const TargetLibraryInfo &TLI, std::map< uint64_t, AllocMatchInfo > &FullStackIdToAllocMatchInfo, std::set< std::vector< uint64_t > > &MatchedCallSites, DenseMap< uint64_t, LocToLocMap > &UndriftMaps, OptimizationRemarkEmitter &ORE, uint64_t MaxColdSize, DenseSet< uint64_t > &SeenStacks, DenseSet< uint64_t > &SeenFrames)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "memprof"

Definition at line 45 of file MemProfUse.cpp.

Function Documentation

◆ addCallsiteMetadata()

void addCallsiteMetadata ( Instruction & I,
ArrayRef< uint64_t > InlinedCallStack,
LLVMContext & Ctx )
static

Definition at line 76 of file MemProfUse.cpp.

References llvm::memprof::buildCallstackMetadata(), and I.

Referenced by handleAllocSite(), and handleCallSite().

◆ addCallStack()

◆ addVPMetadata()

◆ computeStackId() [1/2]

◆ computeStackId() [2/2]

◆ dumpInlineCallStack()

◆ getAllocType()

AllocationType getAllocType ( const AllocationInfo * AllocInfo)
static

Definition at line 109 of file MemProfUse.cpp.

References llvm::memprof::getAllocType().

◆ getLineOffset()

uint32_t getLineOffset ( const DILocation * DIL)
static

◆ getStringContentHash()

std::optional< uint64_t > getStringContentHash ( const GlobalVariable & GVar)
static

◆ handleAllocSite()

◆ handleCallSite()

◆ HandleUnsupportedAnnotationKinds()

◆ isAllocationWithHotColdVariant()

bool isAllocationWithHotColdVariant ( const InstrumentationOptions & Opts,
const Function * Callee,
const TargetLibraryInfo & TLI )
static

◆ readMemprof()

◆ stackFrameIncludesInlinedCallStack()

bool stackFrameIncludesInlinedCallStack ( ArrayRef< Frame > ProfileCallStack,
ArrayRef< uint64_t > InlinedCallStack )
static

◆ 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()