@@ -996,9 +996,14 @@ Expected<std::unique_ptr<Session>> Session::Create(Triple TT,
996996 std::unique_ptr<TaskDispatcher> Dispatcher;
997997 if (MaterializationThreads == 0 )
998998 Dispatcher = std::make_unique<InPlaceTaskDispatcher>();
999- else
999+ else {
1000+ #if LLVM_ENABLE_THREADS
10001001 Dispatcher = std::make_unique<DynamicThreadPoolTaskDispatcher>(
10011002 MaterializationThreads);
1003+ #else
1004+ llvm_unreachable (" MaterializationThreads should be 0" );
1005+ #endif
1006+ }
10021007
10031008 EPC = std::make_unique<SelfExecutorProcessControl>(
10041009 std::make_shared<SymbolStringPool>(), std::move (Dispatcher),
@@ -1628,15 +1633,24 @@ static Error sanitizeArguments(const Triple &TT, const char *ArgV0) {
16281633 }
16291634 }
16301635
1636+ #if LLVM_ENABLE_THREADS
16311637 if (MaterializationThreads == std::numeric_limits<size_t >::max ()) {
16321638 if (auto HC = std::thread::hardware_concurrency ())
16331639 MaterializationThreads = HC;
16341640 else {
16351641 errs () << " Warning: std::thread::hardware_concurrency() returned 0, "
1636- " defaulting to -threads=1.\n " ;
1642+ " defaulting to -num- threads=1.\n " ;
16371643 MaterializationThreads = 1 ;
16381644 }
16391645 }
1646+ #else
1647+ if (MaterializationThreads.getNumOccurrences () &&
1648+ MaterializationThreads != 0 ) {
1649+ errs () << " Warning: -num-threads was set, but LLVM was built with threads "
1650+ " disabled. Resetting to -num-threads=0\n " ;
1651+ }
1652+ MaterializationThreads = 0 ;
1653+ #endif
16401654
16411655 if (!!OutOfProcessExecutor.getNumOccurrences () ||
16421656 !!OutOfProcessExecutorConnect.getNumOccurrences ()) {
0 commit comments