mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
Bitcode: Make the summary reader responsible for merging. NFCI.
This is to prepare for an upcoming change which uses pointers instead of GUIDs to represent references. Differential Revision: https://reviews.llvm.org/D32469 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,42 +16,6 @@
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
using namespace llvm;
|
||||
|
||||
// Create the combined module index/summary from multiple
|
||||
// per-module instances.
|
||||
void ModuleSummaryIndex::mergeFrom(std::unique_ptr<ModuleSummaryIndex> Other,
|
||||
uint64_t NextModuleId) {
|
||||
if (Other->modulePaths().empty())
|
||||
return;
|
||||
|
||||
assert(Other->modulePaths().size() == 1 &&
|
||||
"Can only merge from an single-module index at that time");
|
||||
|
||||
StringRef OtherModPath = Other->modulePaths().begin()->first();
|
||||
StringRef ModPath = addModulePath(OtherModPath, NextModuleId,
|
||||
Other->getModuleHash(OtherModPath))
|
||||
->first();
|
||||
|
||||
for (auto &OtherGlobalValSummaryLists : *Other) {
|
||||
GlobalValue::GUID ValueGUID = OtherGlobalValSummaryLists.first;
|
||||
GlobalValueSummaryList &List = OtherGlobalValSummaryLists.second;
|
||||
|
||||
// Assert that the value summary list only has one entry, since we shouldn't
|
||||
// have duplicate names within a single per-module index.
|
||||
assert(List.size() == 1);
|
||||
std::unique_ptr<GlobalValueSummary> Summary = std::move(List.front());
|
||||
|
||||
// Note the module path string ref was copied above and is still owned by
|
||||
// the original per-module index. Reset it to the new module path
|
||||
// string reference owned by the combined index.
|
||||
Summary->setModulePath(ModPath);
|
||||
|
||||
// Add new value summary to existing list. There may be duplicates when
|
||||
// combining GlobalValueMap entries, due to COMDAT values. Any local
|
||||
// values were given unique global IDs.
|
||||
addGlobalValueSummary(ValueGUID, std::move(Summary));
|
||||
}
|
||||
}
|
||||
|
||||
// Collect for the given module the list of function it defines
|
||||
// (GUID -> Summary).
|
||||
void ModuleSummaryIndex::collectDefinedFunctionsForModule(
|
||||
|
||||
Reference in New Issue
Block a user