llvm.org GIT mirror llvm / 156c648
[ThinLTOCodeGenerator] Avoid Rehash StringMap in ThreadPool Summary: During threaded thinLTO, it is possible that the entry for current module doesn't exist in StringMaps (like ExportLists, ResolvedODR, etc.). Using operator[] might trigger a rehash for the StringMap, which might happen on multiple threads at the same time. rdar://problem/43846199 Reviewers: tejohnson, mehdi_amini, kromanova, pcc Reviewed By: tejohnson Subscribers: dang, inglorion, eraman, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D52049 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342263 91177308-0d34-0410-b5e6-96231b3b80d8 Steven Wu 1 year, 1 day ago
1 changed file(s) with 9 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
949949 // Changes are made in the index, consumed in the ThinLTO backends.
950950 internalizeAndPromoteInIndex(ExportLists, GUIDPreservedSymbols, *Index);
951951
952 // Make sure that every module has an entry in the ExportLists and
953 // ResolvedODR maps to enable threaded access to these maps below.
954 for (auto &DefinedGVSummaries : ModuleToDefinedGVSummaries) {
955 ExportLists[DefinedGVSummaries.first()];
956 ResolvedODR[DefinedGVSummaries.first()];
952 // Make sure that every module has an entry in the ExportLists, ImportList,
953 // GVSummary and ResolvedODR maps to enable threaded access to these maps
954 // below.
955 for (auto &Module : Modules) {
956 auto ModuleIdentifier = Module.getBufferIdentifier();
957 ExportLists[ModuleIdentifier];
958 ImportLists[ModuleIdentifier];
959 ResolvedODR[ModuleIdentifier];
960 ModuleToDefinedGVSummaries[ModuleIdentifier];
957961 }
958962
959963 // Compute the ordering we will process the inputs: the rough heuristic here