LLVM: lib/Analysis/ModuleSummaryAnalysis.cpp File Reference (original) (raw)

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 "module-summary-analysis"
Functions
static bool findRefEdges (ModuleSummaryIndex &Index, const User *CurUser, SetVector< ValueInfo, SmallVector< ValueInfo, 0 > > &RefEdges, SmallPtrSet< const User *, 8 > &Visited, bool &RefLocalLinkageIFunc)
static CalleeInfo::HotnessType getHotness (uint64_t ProfileCount, ProfileSummaryInfo *PSI)
static bool isNonRenamableLocal (const GlobalValue &GV)
static void addVCallToSet (DevirtCallSite Call, GlobalValue::GUID Guid, SetVector< FunctionSummary::VFuncId, std::vector< FunctionSummary::VFuncId > > &VCalls, SetVector< FunctionSummary::ConstVCall, std::vector< FunctionSummary::ConstVCall > > &ConstVCalls)
Determine whether this call has all constant integer arguments (excluding "this") and summarize it to VCalls or ConstVCalls as appropriate.
static void addIntrinsicToSummary (const CallInst *CI, SetVector< GlobalValue::GUID, std::vector< GlobalValue::GUID > > &TypeTests, SetVector< FunctionSummary::VFuncId, std::vector< FunctionSummary::VFuncId > > &TypeTestAssumeVCalls, SetVector< FunctionSummary::VFuncId, std::vector< FunctionSummary::VFuncId > > &TypeCheckedLoadVCalls, SetVector< FunctionSummary::ConstVCall, std::vector< FunctionSummary::ConstVCall > > &TypeTestAssumeConstVCalls, SetVector< FunctionSummary::ConstVCall, std::vector< FunctionSummary::ConstVCall > > &TypeCheckedLoadConstVCalls, DominatorTree &DT)
If this intrinsic call requires that we add information to the function summary, do so via the non-constant reference arguments.
static bool isNonVolatileLoad (const Instruction *I)
static bool isNonVolatileStore (const Instruction *I)
static bool mustBeUnreachableFunction (const Function &F)
static void computeFunctionSummary (ModuleSummaryIndex &Index, const Module &M, const Function &F, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI, DominatorTree &DT, bool HasLocalsInUsedOrAsm, DenseSet< GlobalValue::GUID > &CantBePromoted, bool IsThinLTO, std::function< const StackSafetyInfo *(const Function &F)> GetSSICallback)
static void findFuncPointers (const Constant *I, uint64_t StartingOffset, const Module &M, ModuleSummaryIndex &Index, VTableFuncList &VTableFuncs, const GlobalVariable &OrigGV)
Find function pointers referenced within the given vtable initializer (or subset of an initializer) I.
static void computeVTableFuncs (ModuleSummaryIndex &Index, const GlobalVariable &V, const Module &M, VTableFuncList &VTableFuncs)
static void recordTypeIdCompatibleVtableReferences (ModuleSummaryIndex &Index, const GlobalVariable &V, SmallVectorImpl< MDNode * > &Types)
Record vtable definition V for each type metadata it references.
static void computeVariableSummary (ModuleSummaryIndex &Index, const GlobalVariable &V, DenseSet< GlobalValue::GUID > &CantBePromoted, const Module &M, SmallVectorImpl< MDNode * > &Types)
static void computeAliasSummary (ModuleSummaryIndex &Index, const GlobalAlias &A, DenseSet< GlobalValue::GUID > &CantBePromoted)
static void setLiveRoot (ModuleSummaryIndex &Index, StringRef Name)
INITIALIZE_PASS_BEGIN (ModuleSummaryIndexWrapperPass, "module-summary-analysis", "Module Summary Analysis", false, true) INITIALIZE_PASS_END(ModuleSummaryIndexWrapperPass
INITIALIZE_PASS (ImmutableModuleSummaryIndexWrapperPass, "module-summary-info", "Module summary info", false, true) bool llvm
Variables
FunctionSummary::ForceSummaryHotnessType llvm::ForceSummaryEdgesCold
static cl::opt< FunctionSummary::ForceSummaryHotnessType, true > FSEC ("force-summary-edges-cold", cl::Hidden, cl::location(ForceSummaryEdgesCold), cl::desc("Force all edges in the function summary to cold"), cl::values(clEnumValN(FunctionSummary::FSHT_None, "none", "None."), clEnumValN(FunctionSummary::FSHT_AllNonCritical, "all-non-critical", "All non-critical edges."), clEnumValN(FunctionSummary::FSHT_All, "all", "All edges.")))
static cl::opt< std::string > ModuleSummaryDotFile ("module-summary-dot-file", cl::Hidden, cl::value_desc("filename"), cl::desc("File to emit dot graph of new summary into"))
static cl::opt< bool > EnableMemProfIndirectCallSupport ("enable-memprof-indirect-call-support", cl::init(false), cl::Hidden, cl::desc("Enable MemProf support for summarizing and cloning indirect calls"))
cl::opt< bool > ScalePartialSampleProfileWorkingSetSize
cl::opt< unsigned > MaxNumVTableAnnotations
cl::opt< bool > MemProfReportHintedSizes
module summary analysis
module summary Module Summary Analysis
module summary Module Summary false

DEBUG_TYPE

#define DEBUG_TYPE "module-summary-analysis"

addIntrinsicToSummary()

static void addIntrinsicToSummary ( const CallInst * CI, SetVector< GlobalValue::GUID, std::vector< GlobalValue::GUID > > & TypeTests, SetVector< FunctionSummary::VFuncId, std::vector< FunctionSummary::VFuncId > > & TypeTestAssumeVCalls, SetVector< FunctionSummary::VFuncId, std::vector< FunctionSummary::VFuncId > > & TypeCheckedLoadVCalls, SetVector< FunctionSummary::ConstVCall, std::vector< FunctionSummary::ConstVCall > > & TypeTestAssumeConstVCalls, SetVector< FunctionSummary::ConstVCall, std::vector< FunctionSummary::ConstVCall > > & TypeCheckedLoadConstVCalls, DominatorTree & DT ) static

If this intrinsic call requires that we add information to the function summary, do so via the non-constant reference arguments.

Definition at line 204 of file ModuleSummaryAnalysis.cpp.

References addVCallToSet(), llvm::any_of(), llvm::findDevirtualizableCallsForTypeCheckedLoad(), llvm::findDevirtualizableCallsForTypeTest(), llvm::CallBase::getArgOperand(), llvm::CallBase::getCalledFunction(), llvm::GlobalValue::getGUID(), llvm::Function::getIntrinsicID(), llvm::Guid, and llvm::Value::uses().

Referenced by computeFunctionSummary().

addVCallToSet()

computeAliasSummary()

computeFunctionSummary()

Definition at line 302 of file ModuleSummaryAnalysis.cpp.

References addIntrinsicToSummary(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), BBFreq, llvm::memprof::CallStack< NodeT, IteratorT >::beginAfterSharedPrefix(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::SmallVectorBase< Size_T >::empty(), llvm::memprof::CallStack< NodeT, IteratorT >::empty(), EnableMemProfIndirectCallSupport, llvm::memprof::CallStack< NodeT, IteratorT >::end(), llvm::SmallVectorImpl< T >::erase(), F, findRefEdges(), llvm::ForceSummaryEdgesCold, llvm::FunctionSummary::FSHT_All, llvm::FunctionSummary::FSHT_None, llvm::BlockAddress::get(), getHotness(), llvm::memprof::getMIBAllocType(), llvm::memprof::getMIBStackNode(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), llvm::ProfileSummaryInfo::getProfileCount(), llvm::ICallPromotionAnalysis::getPromotionCandidatesForInstruction(), llvm::ProfileSummaryInfo::hasPartialSampleProfile(), I, llvm::SetVector< T, Vector, Set, N >::insert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), isNonRenamableLocal(), isNonVolatileLoad(), isNonVolatileStore(), llvm::mayHaveMemprofSummary(), MemProfReportHintedSizes, mustBeUnreachableFunction(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SetVector< T, Vector, Set, N >::remove(), ScalePartialSampleProfileWorkingSetSize, llvm::SetVector< T, Vector, Set, N >::size(), llvm::SmallVectorBase< Size_T >::size(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::takeVector(), llvm::SetVector< T, Vector, Set, N >::takeVector(), and users.

Referenced by llvm::buildModuleSummaryIndex().

computeVariableSummary()

Definition at line 833 of file ModuleSummaryAnalysis.cpp.

References computeVTableFuncs(), llvm::GlobalValueSummary::Definition, findRefEdges(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), isNonRenamableLocal(), recordTypeIdCompatibleVtableReferences(), and llvm::SetVector< T, Vector, Set, N >::takeVector().

Referenced by llvm::buildModuleSummaryIndex().

computeVTableFuncs()

findFuncPointers()

Find function pointers referenced within the given vtable initializer (or subset of an initializer) I.

The starting offset of I within the vtable initializer is StartingOffset. Any discovered function pointers are added to VTableFuncs along with their cumulative offset within the initializer.

Definition at line 720 of file ModuleSummaryAnalysis.cpp.

References A, assert(), llvm::CallingConv::C, DL, llvm::StructType::elements(), llvm::enumerate(), findFuncPointers(), llvm::StructLayout::getElementContainingOffset(), llvm::StructLayout::getElementOffset(), llvm::GlobalVariable::getInitializer(), llvm::Value::getType(), I, llvm::IsConstantOffsetFromGlobal(), LHS, llvm::Offset, and RHS.

Referenced by computeVTableFuncs(), and findFuncPointers().

findRefEdges()

getHotness()

INITIALIZE_PASS()

INITIALIZE_PASS_BEGIN()

isNonRenamableLocal()

isNonVolatileLoad()

isNonVolatileStore()

mustBeUnreachableFunction()

recordTypeIdCompatibleVtableReferences()

setLiveRoot()

Analysis

module summary Module Summary Analysis

EnableMemProfIndirectCallSupport

cl::opt< bool > EnableMemProfIndirectCallSupport("enable-memprof-indirect-call-support", cl::init(false), cl::Hidden, cl::desc( "Enable MemProf support for summarizing and cloning indirect calls")) ( "enable-memprof-indirect-call-support" , cl::init(false) , cl::Hidden , cl::desc( "Enable MemProf support for summarizing and cloning indirect calls") ) static

false

module summary Module Summary false

FSEC

cl::opt< FunctionSummary::ForceSummaryHotnessType, true > FSEC("force-summary-edges-cold", cl::Hidden, cl::location(ForceSummaryEdgesCold), cl::desc("Force all edges in the function summary to cold"), cl::values(clEnumValN(FunctionSummary::FSHT_None, "none", "None."), clEnumValN(FunctionSummary::FSHT_AllNonCritical, "all-non-critical", "All non-critical edges."), clEnumValN(FunctionSummary::FSHT_All, "all", "All edges."))) ( "force-summary-edges-cold" , cl::Hidden , cl::location(ForceSummaryEdgesCold) , cl::desc("Force all edges in the function summary to cold") , cl::values(clEnumValN(FunctionSummary::FSHT_None, "none", "None."), clEnumValN(FunctionSummary::FSHT_AllNonCritical, "all-non-critical", "All non-critical edges."), clEnumValN(FunctionSummary::FSHT_All, "all", "All edges.")) ) static

MaxNumVTableAnnotations

MemProfReportHintedSizes

ModuleSummaryDotFile

cl::opt< std::string > ModuleSummaryDotFile("module-summary-dot-file", cl::Hidden, cl::value_desc("filename"), cl::desc("File to emit dot graph of new summary into")) ( "module-summary-dot-file" , cl::Hidden , cl::value_desc("filename") , cl::desc("File to emit dot graph of new summary into") ) static

ScalePartialSampleProfileWorkingSetSize