Skip to content

Commit 92bec0e

Browse files
committed
[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 f341161.
1 parent 5e58b63 commit 92bec0e

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,13 @@ static Expected<std::unique_ptr<ExecutorProcessControl>> launchExecutor() {
736736
return make_error<StringError>("-" + OutOfProcessExecutor.ArgStr +
737737
" not supported on non-unix platforms",
738738
inconvertibleErrorCode());
739+
#elif !LLVM_ENABLE_THREADS
740+
// Out of process mode using SimpleRemoteEPC depends on threads.
741+
return make_error<StringError>(
742+
"-" + OutOfProcessExecutor.ArgStr +
743+
" requires threads, but LLVM was built with "
744+
"LLVM_ENABLE_THREADS=Off",
745+
inconvertibleErrorCode());
739746
#else
740747

741748
constexpr int ReadEnd = 0;
@@ -795,7 +802,7 @@ static Expected<std::unique_ptr<ExecutorProcessControl>> launchExecutor() {
795802
#endif
796803
}
797804

798-
#ifdef LLVM_ON_UNIX
805+
#if LLVM_ON_UNIX && LLVM_ENABLE_THREADS
799806
static Error createTCPSocketError(Twine Details) {
800807
return make_error<StringError>(
801808
formatv("Failed to connect TCP socket '{0}': {1}",
@@ -847,6 +854,13 @@ static Expected<std::unique_ptr<ExecutorProcessControl>> connectToExecutor() {
847854
return make_error<StringError>("-" + OutOfProcessExecutorConnect.ArgStr +
848855
" not supported on non-unix platforms",
849856
inconvertibleErrorCode());
857+
#elif !LLVM_ENABLE_THREADS
858+
// Out of process mode using SimpleRemoteEPC depends on threads.
859+
return make_error<StringError>(
860+
"-" + OutOfProcessExecutorConnect.ArgStr +
861+
" requires threads, but LLVM was built with "
862+
"LLVM_ENABLE_THREADS=Off",
863+
inconvertibleErrorCode());
850864
#else
851865

852866
StringRef Host, PortStr;
@@ -907,8 +921,8 @@ Expected<std::unique_ptr<Session>> Session::Create(Triple TT) {
907921
return PageSize.takeError();
908922
EPC = std::make_unique<SelfExecutorProcessControl>(
909923
std::make_shared<SymbolStringPool>(),
910-
std::make_unique<DynamicThreadPoolTaskDispatcher>(),
911-
std::move(TT), *PageSize, createMemoryManager());
924+
std::make_unique<InPlaceTaskDispatcher>(), std::move(TT), *PageSize,
925+
createMemoryManager());
912926
}
913927

914928
Error Err = Error::success();

0 commit comments

Comments
 (0)