From 0beb858e979602ce33c7298da9d2ae02aa2d69ad Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Mon, 4 Apr 2016 18:52:23 +0000 Subject: [PATCH] [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 --- llvm/lib/Transforms/IPO/FunctionImport.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index f69bc1d..a1d36de 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -320,7 +320,14 @@ bool FunctionImporter::importFunctions( // Find the globals to import DenseSet 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); } -- 2.7.4