[llvm] r317263 - Fix llvm-dsymutil test in -DLLVM_ENABLE_THREADS=OFF mode

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 13:22:03 PDT 2017


Author: hans
Date: Thu Nov  2 13:22:03 2017
New Revision: 317263

URL: http://llvm.org/viewvc/llvm-project?rev=317263&view=rev
Log:
Fix llvm-dsymutil test in -DLLVM_ENABLE_THREADS=OFF mode

After r316999, tools/dsymutil/X86/alias.test started failing in builds
that have threading disabled.

Modified:
    llvm/trunk/tools/dsymutil/dsymutil.cpp

Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=317263&r1=317262&r2=317263&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Thu Nov  2 13:22:03 2017
@@ -338,7 +338,6 @@ int main(int argc, char **argv) {
       NumThreads = 1;
     NumThreads = std::min<unsigned>(NumThreads, DebugMapPtrsOrErr->size());
 
-    llvm::ThreadPool Threads(NumThreads);
 
     // If there is more than one link to execute, we need to generate
     // temporary files.
@@ -366,17 +365,19 @@ int main(int argc, char **argv) {
       // FIXME: The DwarfLinker can have some very deep recursion that can max
       // out the (significantly smaller) stack when using threads. We don't
       // want this limitation when we only have a single thread.
-      if (NumThreads == 1)
+      if (NumThreads == 1) {
         LinkLambda();
-      else
+      } else {
+        llvm::ThreadPool Threads(NumThreads);
         Threads.async(LinkLambda);
+        Threads.wait();
+      }
 
       if (NeedsTempFiles)
         TempFiles.emplace_back(Map->getTriple().getArchName().str(),
                                OutputFile);
     }
 
-    Threads.wait();
 
     if (NeedsTempFiles &&
         !MachOUtils::generateUniversalBinary(




More information about the llvm-commits mailing list