22 uint64_t NextModuleId) {
23 if (Other->modulePaths().empty())
26 assert(Other->modulePaths().size() == 1 &&
27 "Can only merge from an single-module index at that time");
31 Other->getModuleHash(OtherModPath))
34 for (
auto &OtherGlobalValSummaryLists : *Other) {
41 std::unique_ptr<GlobalValueSummary> Summary = std::move(List.front());
46 Summary->setModulePath(ModPath);
61 MI = GlobalValueMap.erase(
MI);
71 for (
auto &GlobalList : *
this) {
72 auto GUID = GlobalList.first;
73 for (
auto &GlobSummary : GlobalList.second) {
74 auto *Summary = dyn_cast_or_null<FunctionSummary>(GlobSummary.get());
79 if (Summary->modulePath() != ModulePath)
81 GVSummaryMap[GUID] = Summary;
89 for (
auto &GlobalList : *
this) {
90 auto GUID = GlobalList.first;
91 for (
auto &Summary : GlobalList.second) {
92 ModuleToDefinedGVSummaries[Summary->modulePath()][GUID] = Summary.get();
99 bool PerModuleIndex)
const {
101 assert(SummaryList !=
end() &&
"GlobalValue not found in index");
102 assert((!PerModuleIndex || SummaryList->second.size() == 1) &&
103 "Expected a single entry per global value in per-module index");
104 auto &Summary = SummaryList->second[0];
105 return Summary.get();
std::vector< std::unique_ptr< GlobalValueSummary > > GlobalValueSummaryList
List of global value summary structures for a particular value held in the GlobalValueMap.
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
ModulePathStringTableTy::iterator addModulePath(StringRef ModPath, uint64_t ModId, ModuleHash Hash=ModuleHash{{0}})
Add a new module path with the given Hash, mapped to the given ModID, and return an iterator to the e...
void collectDefinedFunctionsForModule(StringRef ModulePath, GVSummaryMapTy &GVSummaryMap) const
Collect for the given module the list of function it defines (GUID -> Summary).
const const_gvsummary_iterator findGlobalValueSummaryList(StringRef ValueName) const
Get the list of global value summary objects for a given value name.
Function and variable summary information to aid decisions and implementation of importing.
void addGlobalValueSummary(StringRef ValueName, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value of the given name.
void collectDefinedGVSummariesPerModule(StringMap< GVSummaryMapTy > &ModuleToDefinedGVSummaries) const
Collect for each module the list of Summaries it defines (GUID -> Summary).
std::map< GlobalValue::GUID, GlobalValueSummary * > GVSummaryMapTy
Map of global value GUID to its summary, used to identify values defined in a particular module...
void removeEmptySummaryEntries()
Remove entries in the GlobalValueMap that have empty summaries due to the eager nature of map entry c...
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
GlobalValueSummary * getGlobalValueSummary(const GlobalValue &GV, bool PerModuleIndex=true) const
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
gvsummary_iterator begin()
void mergeFrom(std::unique_ptr< ModuleSummaryIndex > Other, uint64_t NextModuleId)
Add the given per-module index into this module index/summary, assigning it the given module ID...
StringRef - Represent a constant reference to a string, i.e.