Changeset View
Changeset View
Standalone View
Standalone View
lib/Analysis/ModuleSummaryAnalysis.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | cl::values(clEnumValN(FunctionSummary::FSHT_None, "none", "None."), | ||||
"all-non-critical", "All non-critical edges."), | "all-non-critical", "All non-critical edges."), | ||||
clEnumValN(FunctionSummary::FSHT_All, "all", "All edges."))); | clEnumValN(FunctionSummary::FSHT_All, "all", "All edges."))); | ||||
cl::opt<std::string> ModuleSummaryDotFile( | cl::opt<std::string> ModuleSummaryDotFile( | ||||
"module-summary-dot-file", cl::init(""), cl::Hidden, | "module-summary-dot-file", cl::init(""), cl::Hidden, | ||||
cl::value_desc("filename"), | cl::value_desc("filename"), | ||||
cl::desc("File to emit dot graph of new summary into.")); | cl::desc("File to emit dot graph of new summary into.")); | ||||
extern cl::opt<bool> FlattenedProfileUsed; | |||||
// Walk through the operands of a given User via worklist iteration and populate | // Walk through the operands of a given User via worklist iteration and populate | ||||
// the set of GlobalValue references encountered. Invoked either on an | // the set of GlobalValue references encountered. Invoked either on an | ||||
// Instruction or a GlobalVariable (which walks its initializer). | // Instruction or a GlobalVariable (which walks its initializer). | ||||
// Return true if any of the operands contains blockaddress. This is important | // Return true if any of the operands contains blockaddress. This is important | ||||
// to know when computing summary for global var, because if global variable | // to know when computing summary for global var, because if global variable | ||||
// references basic block address we can't import it separately from function | // references basic block address we can't import it separately from function | ||||
// containing that basic block. For simplicity we currently don't import such | // containing that basic block. For simplicity we currently don't import such | ||||
// global vars at all. When importing function we aren't interested if any | // global vars at all. When importing function we aren't interested if any | ||||
▲ Show 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | ModuleSummaryIndex llvm::buildModuleSummaryIndex( | ||||
const Module &M, | const Module &M, | ||||
std::function<BlockFrequencyInfo *(const Function &F)> GetBFICallback, | std::function<BlockFrequencyInfo *(const Function &F)> GetBFICallback, | ||||
ProfileSummaryInfo *PSI) { | ProfileSummaryInfo *PSI) { | ||||
assert(PSI); | assert(PSI); | ||||
bool EnableSplitLTOUnit = false; | bool EnableSplitLTOUnit = false; | ||||
if (auto *MD = mdconst::extract_or_null<ConstantInt>( | if (auto *MD = mdconst::extract_or_null<ConstantInt>( | ||||
M.getModuleFlag("EnableSplitLTOUnit"))) | M.getModuleFlag("EnableSplitLTOUnit"))) | ||||
EnableSplitLTOUnit = MD->getZExtValue(); | EnableSplitLTOUnit = MD->getZExtValue(); | ||||
ModuleSummaryIndex Index(/*HaveGVs=*/true, EnableSplitLTOUnit); | ModuleSummaryIndex Index(/*HaveGVs=*/true, EnableSplitLTOUnit, | ||||
FlattenedProfileUsed); | |||||
// Identify the local values in the llvm.used and llvm.compiler.used sets, | // Identify the local values in the llvm.used and llvm.compiler.used sets, | ||||
// which should not be exported as they would then require renaming and | // which should not be exported as they would then require renaming and | ||||
// promotion, but we may have opaque uses e.g. in inline asm. We collect them | // promotion, but we may have opaque uses e.g. in inline asm. We collect them | ||||
// here because we use this information to mark functions containing inline | // here because we use this information to mark functions containing inline | ||||
// assembly calls as not importable. | // assembly calls as not importable. | ||||
SmallPtrSet<GlobalValue *, 8> LocalsUsed; | SmallPtrSet<GlobalValue *, 8> LocalsUsed; | ||||
SmallPtrSet<GlobalValue *, 8> Used; | SmallPtrSet<GlobalValue *, 8> Used; | ||||
▲ Show 20 Lines • Show All 224 Lines • Show Last 20 Lines |