summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2018-07-10 20:06:04 +0000
committerTeresa Johnson <tejohnson@google.com>2018-07-10 20:06:04 +0000
commitc0320ef47b16272464900df8a7c5a4cb3d1f20c9 (patch)
tree9f9ec44ab6b4567fc2d834ed8e686a0602d84cc7 /llvm/lib/LTO/ThinLTOCodeGenerator.cpp
parentfb302d0198e3bab1ee9b044a6d0b7f361f4d437c (diff)
downloadbcm5719-llvm-c0320ef47b16272464900df8a7c5a4cb3d1f20c9.tar.gz
bcm5719-llvm-c0320ef47b16272464900df8a7c5a4cb3d1f20c9.zip
[ThinLTO] Use std::map to get determistic imports files
Summary: I noticed that the .imports files emitted for distributed ThinLTO backends do not have consistent ordering. This is because StringMap iteration order is not guaranteed to be deterministic. Since we already have a std::map with this information, used when emitting the individual index files (ModuleToSummariesForIndex), use it for the imports files as well. This issue is likely causing some unnecessary rebuilds of the ThinLTO backends in our distributed build system as the imports files are inputs to those backends. Reviewers: pcc, steven_wu, mehdi_amini Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D48783 llvm-svn: 336721
Diffstat (limited to 'llvm/lib/LTO/ThinLTOCodeGenerator.cpp')
-rw-r--r--llvm/lib/LTO/ThinLTOCodeGenerator.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index d7fac6a993f..90d0f9bdb88 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -758,8 +758,14 @@ void ThinLTOCodeGenerator::emitImports(StringRef ModulePath,
ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries, ImportLists,
ExportLists);
+ std::map<std::string, GVSummaryMapTy> ModuleToSummariesForIndex;
+ llvm::gatherImportedSummariesForModule(ModulePath, ModuleToDefinedGVSummaries,
+ ImportLists[ModulePath],
+ ModuleToSummariesForIndex);
+
std::error_code EC;
- if ((EC = EmitImportsFiles(ModulePath, OutputName, ImportLists[ModulePath])))
+ if ((EC =
+ EmitImportsFiles(ModulePath, OutputName, ModuleToSummariesForIndex)))
report_fatal_error(Twine("Failed to open ") + OutputName +
" to save imports lists\n");
}
OpenPOWER on IntegriCloud