summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-05-10 13:48:23 +0000
committerTeresa Johnson <tejohnson@google.com>2016-05-10 13:48:23 +0000
commit84174c3771e69214474b09e4afb26f10eef49245 (patch)
tree1b8f50c93464050b2cc1b8a81b0c9ada4d91c82b /llvm/lib/LTO
parent7189b0fdb2d06b4107185428aee8c31157ee9c9c (diff)
downloadbcm5719-llvm-84174c3771e69214474b09e4afb26f10eef49245.tar.gz
bcm5719-llvm-84174c3771e69214474b09e4afb26f10eef49245.zip
Restore "[ThinLTO] Emit individual index files for distributed backends"
This restores commit r268627: Summary: When launching ThinLTO backends in a distributed build (currently supported in gold via the thinlto-index-only plugin option), emit an individual index file for each backend process as described here: http://lists.llvm.org/pipermail/llvm-dev/2016-April/098272.html ... Differential Revision: http://reviews.llvm.org/D19556 Address msan failures by avoiding std::prev on map.end(), the theory is that this is causing issues due to some known UB problems in __tree. llvm-svn: 269059
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r--llvm/lib/LTO/ThinLTOCodeGenerator.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 70da5b33a58..68d7a714b6b 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -720,6 +720,29 @@ void ThinLTOCodeGenerator::crossModuleImport(Module &TheModule,
}
/**
+ * Compute the list of summaries needed for importing into module.
+ */
+void ThinLTOCodeGenerator::gatherImportedSummariesForModule(
+ StringRef ModulePath, ModuleSummaryIndex &Index,
+ std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex) {
+ auto ModuleCount = Index.modulePaths().size();
+
+ // Collect for each module the list of function it defines (GUID -> Summary).
+ StringMap<GVSummaryMapTy> ModuleToDefinedGVSummaries(ModuleCount);
+ Index.collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries);
+
+ // Generate import/export list
+ StringMap<FunctionImporter::ImportMapTy> ImportLists(ModuleCount);
+ StringMap<FunctionImporter::ExportSetTy> ExportLists(ModuleCount);
+ ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries, ImportLists,
+ ExportLists);
+
+ llvm::gatherImportedSummariesForModule(ModulePath, ModuleToDefinedGVSummaries,
+ ImportLists,
+ ModuleToSummariesForIndex);
+}
+
+/**
* Perform internalization.
*/
void ThinLTOCodeGenerator::internalize(Module &TheModule,
OpenPOWER on IntegriCloud