[llvm] r269588 - ThinLTOCodeGenerator: fix race condition found using TSAN

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Sat May 14 22:49:48 PDT 2016


Author: mehdi_amini
Date: Sun May 15 00:49:47 2016
New Revision: 269588

URL: http://llvm.org/viewvc/llvm-project?rev=269588&view=rev
Log:
ThinLTOCodeGenerator: fix race condition found using TSAN

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp

Modified: llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp?rev=269588&r1=269587&r2=269588&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp Sun May 15 00:49:47 2016
@@ -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);




More information about the llvm-commits mailing list