From 96bc72cb3b68bf026af9e88410dcefb969e4dd68 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sun, 15 May 2016 05:49:47 +0000 Subject: [PATCH] ThinLTOCodeGenerator: fix race condition found using TSAN From: Mehdi Amini llvm-svn: 269588 --- lib/LTO/ThinLTOCodeGenerator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/LTO/ThinLTOCodeGenerator.cpp b/lib/LTO/ThinLTOCodeGenerator.cpp index 33d0a0cd920..2867c730125 100644 --- a/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/lib/LTO/ThinLTOCodeGenerator.cpp @@ -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);