ThinLTOCodeGenerator: fix race condition found using TSAN

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 269588
This commit is contained in:
Mehdi Amini 2016-05-15 05:49:47 +00:00
parent fedb0fd907
commit af52f28d9d
1 changed files with 5 additions and 0 deletions

View File

@ -884,6 +884,11 @@ void ThinLTOCodeGenerator::run() {
auto GUIDPreservedSymbols =
computeGUIDPreservedSymbols(PreservedSymbols, TMBuilder.TheTriple);
// Make sure that every module has an entry in the ExportLists to enable
// threaded access to this map below
for (auto &DefinedGVSummaries : ModuleToDefinedGVSummaries)
ExportLists[DefinedGVSummaries.first()];
// Parallel optimizer + codegen
{
ThreadPool Pool(ThreadCount);