[llvm] 92bec0e - [llvm-jitlink] Don't use thread pool task dispatch when LLVM_ENABLE_THREADS=Off

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 10:20:01 PDT 2021


Author: Lang Hames
Date: 2021-10-13T10:19:55-07:00
New Revision: 92bec0e9704a2006087fe46abfff5efac46942b8

URL: https://github.com/llvm/llvm-project/commit/92bec0e9704a2006087fe46abfff5efac46942b8
DIFF: https://github.com/llvm/llvm-project/commit/92bec0e9704a2006087fe46abfff5efac46942b8.diff

LOG: [llvm-jitlink] Don't use thread pool task dispatch when LLVM_ENABLE_THREADS=Off

This should fix compile errors in llvm-jitlink.cpp in LLVM_ENABLE_THREADS=Off
builds due to f3411616896.

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 3b9972fe49a8c..6c8245a70f2ce 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -736,6 +736,13 @@ static Expected<std::unique_ptr<ExecutorProcessControl>> launchExecutor() {
   return make_error<StringError>("-" + OutOfProcessExecutor.ArgStr +
                                      " not supported on non-unix platforms",
                                  inconvertibleErrorCode());
+#elif !LLVM_ENABLE_THREADS
+  // Out of process mode using SimpleRemoteEPC depends on threads.
+  return make_error<StringError>(
+      "-" + OutOfProcessExecutor.ArgStr +
+          " requires threads, but LLVM was built with "
+          "LLVM_ENABLE_THREADS=Off",
+      inconvertibleErrorCode());
 #else
 
   constexpr int ReadEnd = 0;
@@ -795,7 +802,7 @@ static Expected<std::unique_ptr<ExecutorProcessControl>> launchExecutor() {
 #endif
 }
 
-#ifdef LLVM_ON_UNIX
+#if LLVM_ON_UNIX && LLVM_ENABLE_THREADS
 static Error createTCPSocketError(Twine Details) {
   return make_error<StringError>(
       formatv("Failed to connect TCP socket '{0}': {1}",
@@ -847,6 +854,13 @@ static Expected<std::unique_ptr<ExecutorProcessControl>> connectToExecutor() {
   return make_error<StringError>("-" + OutOfProcessExecutorConnect.ArgStr +
                                      " not supported on non-unix platforms",
                                  inconvertibleErrorCode());
+#elif !LLVM_ENABLE_THREADS
+  // Out of process mode using SimpleRemoteEPC depends on threads.
+  return make_error<StringError>(
+      "-" + OutOfProcessExecutorConnect.ArgStr +
+          " requires threads, but LLVM was built with "
+          "LLVM_ENABLE_THREADS=Off",
+      inconvertibleErrorCode());
 #else
 
   StringRef Host, PortStr;
@@ -907,8 +921,8 @@ Expected<std::unique_ptr<Session>> Session::Create(Triple TT) {
       return PageSize.takeError();
     EPC = std::make_unique<SelfExecutorProcessControl>(
         std::make_shared<SymbolStringPool>(),
-        std::make_unique<DynamicThreadPoolTaskDispatcher>(),
-        std::move(TT), *PageSize, createMemoryManager());
+        std::make_unique<InPlaceTaskDispatcher>(), std::move(TT), *PageSize,
+        createMemoryManager());
   }
 
   Error Err = Error::success();


        


More information about the llvm-commits mailing list