diff options
-rw-r--r-- | llvm/lib/Support/Parallel.cpp | 4 | ||||
-rw-r--r-- | llvm/unittests/Support/ParallelTest.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/Parallel.cpp b/llvm/lib/Support/Parallel.cpp index 9c04af6..f544790 100644 --- a/llvm/lib/Support/Parallel.cpp +++ b/llvm/lib/Support/Parallel.cpp @@ -185,8 +185,12 @@ Executor *Executor::getDefaultExecutor() { // lock, only allow the root TaskGroup to run tasks parallelly. In the scenario // of nested parallel_for_each(), only the outermost one runs parallelly. TaskGroup::TaskGroup() +#if LLVM_ENABLE_THREADS : Parallel((parallel::strategy.ThreadsRequested != 1) && (threadIndex == UINT_MAX)) {} +#else + : Parallel(false) {} +#endif TaskGroup::~TaskGroup() { // We must ensure that all the workloads have finished before decrementing the // instances count. diff --git a/llvm/unittests/Support/ParallelTest.cpp b/llvm/unittests/Support/ParallelTest.cpp index 7afe650..53ef9fa 100644 --- a/llvm/unittests/Support/ParallelTest.cpp +++ b/llvm/unittests/Support/ParallelTest.cpp @@ -103,6 +103,7 @@ TEST(Parallel, TaskGroupSequentialFor) { EXPECT_EQ(Count, 500ul); } +#if LLVM_ENABLE_THREADS TEST(Parallel, NestedTaskGroup) { // This test checks: // 1. Root TaskGroup is in Parallel mode. @@ -128,7 +129,6 @@ TEST(Parallel, NestedTaskGroup) { }); } -#if LLVM_ENABLE_THREADS TEST(Parallel, ParallelNestedTaskGroup) { // This test checks that it is possible to have several TaskGroups // run from different threads in Parallel mode. |