diff --git a/llvm/lib/Support/BalancedPartitioning.cpp b/llvm/lib/Support/BalancedPartitioning.cpp --- a/llvm/lib/Support/BalancedPartitioning.cpp +++ b/llvm/lib/Support/BalancedPartitioning.cpp @@ -27,6 +27,7 @@ template void BalancedPartitioning::BPThreadPool::async(Func &&F) { +#if LLVM_ENABLE_THREADS // This new thread could spawn more threads, so mark it as active ++NumActiveThreads; TheThreadPool.async([=]() { @@ -44,9 +45,13 @@ cv.notify_one(); } }); +#else + llvm_unreachable("threads are disabled"); +#endif } void BalancedPartitioning::BPThreadPool::wait() { +#if LLVM_ENABLE_THREADS // TODO: We could remove the mutex and condition variable and use // std::atomic::wait() instead, but that isn't available until C++20 { @@ -56,6 +61,9 @@ } // Now we can call ThreadPool::wait() since all tasks have been submitted TheThreadPool.wait(); +#else + llvm_unreachable("threads are disabled"); +#endif } BalancedPartitioning::BalancedPartitioning( @@ -73,8 +81,10 @@ "Partitioning %d nodes using depth %d and %d iterations per split\n", Nodes.size(), Config.SplitDepth, Config.IterationsPerSplit)); std::optional TP; +#if LLVM_ENABLE_THREADS if (Config.TaskSplitDepth > 1) TP.emplace(); +#endif // Record the input order for (unsigned I = 0; I < Nodes.size(); I++) diff --git a/llvm/test/tools/llvm-profdata/show-order.proftext b/llvm/test/tools/llvm-profdata/show-order.proftext --- a/llvm/test/tools/llvm-profdata/show-order.proftext +++ b/llvm/test/tools/llvm-profdata/show-order.proftext @@ -1,6 +1,4 @@ # RUN: llvm-profdata order %s | FileCheck %s -# PR63168: Balanced Partitioning tests currently hang on ARM. -# UNSUPPORTED: target=arm{{.*}} # CHECK: a # CHECK: b diff --git a/llvm/unittests/Support/BalancedPartitioningTest.cpp b/llvm/unittests/Support/BalancedPartitioningTest.cpp --- a/llvm/unittests/Support/BalancedPartitioningTest.cpp +++ b/llvm/unittests/Support/BalancedPartitioningTest.cpp @@ -17,13 +17,6 @@ using testing::UnorderedElementsAre; using testing::UnorderedElementsAreArray; -// PR63168: Balanced Partitioning tests currently hang on ARM. -#if defined(__arm__) -#define SKIP_UNSUPPORTED_PLATFORM GTEST_SKIP() -#else -#define SKIP_UNSUPPORTED_PLATFORM do { } while(0) -#endif - namespace llvm { void PrintTo(const BPFunctionNode &Node, std::ostream *OS) { @@ -47,7 +40,6 @@ }; TEST_F(BalancedPartitioningTest, Basic) { - SKIP_UNSUPPORTED_PLATFORM; std::vector Nodes = { BPFunctionNode(0, {1, 2}), BPFunctionNode(2, {3, 4}), BPFunctionNode(1, {1, 2}), BPFunctionNode(3, {3, 4}), @@ -67,7 +59,6 @@ } TEST_F(BalancedPartitioningTest, Large) { - SKIP_UNSUPPORTED_PLATFORM; const int ProblemSize = 1000; std::vector AllUNs; for (int i = 0; i < ProblemSize; i++) @@ -94,7 +85,6 @@ } TEST_F(BalancedPartitioningTest, MoveGain) { - SKIP_UNSUPPORTED_PLATFORM; BalancedPartitioning::SignaturesT Signatures = { {10, 10, 10.f, 0.f, true}, // 0 {10, 10, 0.f, 10.f, true}, // 1