[ThinLTO] Use std::map to get determistic imports files
authorTeresa Johnson <tejohnson@google.com>
Tue, 10 Jul 2018 20:06:04 +0000 (20:06 +0000)
committerTeresa Johnson <tejohnson@google.com>
Tue, 10 Jul 2018 20:06:04 +0000 (20:06 +0000)
commitc0320ef47b16272464900df8a7c5a4cb3d1f20c9
tree9f9ec44ab6b4567fc2d834ed8e686a0602d84cc7
parentfb302d0198e3bab1ee9b044a6d0b7f361f4d437c
[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
llvm/include/llvm/Transforms/IPO/FunctionImport.h
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/test/ThinLTO/X86/Inputs/emit_imports2.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/emit_imports.ll