[ThinLTO] Augment FunctionImport dump with value name to GUID map

Summary:
To aid in debugging, dump out the correlation between value names and
GUID for each source module when it is materialized. This will make it
easier to comprehend the earlier summary-based function importing debug
trace which only has access to and prints the GUIDs.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D18556

llvm-svn: 265326
This commit is contained in:
Teresa Johnson 2016-04-04 18:52:23 +00:00
parent c293a2688d
commit 0beb858e97
1 changed files with 18 additions and 3 deletions

View File

@ -320,7 +320,14 @@ bool FunctionImporter::importFunctions(
// Find the globals to import
DenseSet<const GlobalValue *> GlobalsToImport;
for (auto &GV : *SrcModule) {
if (GV.hasName() && ImportGUIDs.count(GV.getGUID())) {
if (!GV.hasName())
continue;
auto GUID = GV.getGUID();
auto Import = ImportGUIDs.count(GUID);
DEBUG(dbgs() << (Import ? "Is" : "Not") << " importing " << GUID << " "
<< GV.getName() << " from " << SrcModule->getSourceFileName()
<< "\n");
if (Import) {
GV.materialize();
GlobalsToImport.insert(&GV);
}
@ -329,7 +336,11 @@ bool FunctionImporter::importFunctions(
if (!GV.hasName())
continue;
auto GUID = GV.getGUID();
if (ImportGUIDs.count(GUID)) {
auto Import = ImportGUIDs.count(GUID);
DEBUG(dbgs() << (Import ? "Is" : "Not") << " importing " << GUID << " "
<< GV.getName() << " from " << SrcModule->getSourceFileName()
<< "\n");
if (Import) {
// Alias can't point to "available_externally". However when we import
// linkOnceODR the linkage does not change. So we import the alias
// and aliasee only in this case.
@ -345,7 +356,11 @@ bool FunctionImporter::importFunctions(
if (!GV.hasName())
continue;
auto GUID = GV.getGUID();
if (ImportGUIDs.count(GUID)) {
auto Import = ImportGUIDs.count(GUID);
DEBUG(dbgs() << (Import ? "Is" : "Not") << " importing " << GUID << " "
<< GV.getName() << " from " << SrcModule->getSourceFileName()
<< "\n");
if (Import) {
GV.materialize();
GlobalsToImport.insert(&GV);
}