From 20c8e9192d6ecb27e8031eed737bcfe1c02106c6 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Thu, 11 May 2017 00:18:52 +0000 Subject: [PATCH] Try again to fix the buildbots. TaskGroup and Latch need to be in llvm::parallel::detail, not in llvm::detail. llvm-svn: 302751 --- llvm/include/llvm/Support/Parallel.h | 43 +++++++++++++++++------------------- llvm/lib/Support/Parallel.cpp | 2 +- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/llvm/include/llvm/Support/Parallel.h b/llvm/include/llvm/Support/Parallel.h index 12cabcb..e36e0cc 100644 --- a/llvm/include/llvm/Support/Parallel.h +++ b/llvm/include/llvm/Support/Parallel.h @@ -29,7 +29,23 @@ namespace llvm { +namespace parallel { +struct sequential_execution_policy {}; +struct parallel_execution_policy {}; + +template +struct is_execution_policy + : public std::integral_constant< + bool, llvm::is_one_of::value> {}; + +constexpr sequential_execution_policy seq{}; +constexpr parallel_execution_policy par{}; + namespace detail { + +#if LLVM_ENABLE_THREADS + class Latch { uint32_t Count; mutable std::mutex Mutex; @@ -64,24 +80,6 @@ public: void sync() const { L.sync(); } }; -} - -namespace parallel { -struct sequential_execution_policy {}; -struct parallel_execution_policy {}; - -template -struct is_execution_policy - : public std::integral_constant< - bool, llvm::is_one_of::value> {}; - -constexpr sequential_execution_policy seq{}; -constexpr parallel_execution_policy par{}; - -namespace detail { - -#if LLVM_ENABLE_THREADS #if defined(_MSC_VER) template @@ -117,8 +115,7 @@ RandomAccessIterator medianOf3(RandomAccessIterator Start, template void parallel_quick_sort(RandomAccessIterator Start, RandomAccessIterator End, - const Comparator &Comp, detail::TaskGroup &TG, - size_t Depth) { + const Comparator &Comp, TaskGroup &TG, size_t Depth) { // Do a sequential sort for small inputs. if (std::distance(Start, End) < detail::MinParallelSize || Depth == 0) { std::sort(Start, End, Comp); @@ -145,7 +142,7 @@ void parallel_quick_sort(RandomAccessIterator Start, RandomAccessIterator End, template void parallel_sort(RandomAccessIterator Start, RandomAccessIterator End, const Comparator &Comp) { - detail::TaskGroup TG; + TaskGroup TG; parallel_quick_sort(Start, End, Comp, TG, llvm::Log2_64(std::distance(Start, End)) + 1); } @@ -160,7 +157,7 @@ void parallel_for_each(IterTy Begin, IterTy End, FuncTy Fn) { if (TaskSize == 0) TaskSize = 1; - detail::TaskGroup TG; + TaskGroup TG; while (TaskSize <= std::distance(Begin, End)) { TG.spawn([=, &Fn] { std::for_each(Begin, Begin + TaskSize, Fn); }); Begin += TaskSize; @@ -174,7 +171,7 @@ void parallel_for_each_n(IndexTy Begin, IndexTy End, FuncTy Fn) { if (TaskSize == 0) TaskSize = 1; - detail::TaskGroup TG; + TaskGroup TG; IndexTy I = Begin; for (; I + TaskSize < End; I += TaskSize) { TG.spawn([=, &Fn] { diff --git a/llvm/lib/Support/Parallel.cpp b/llvm/lib/Support/Parallel.cpp index 15da66c..3f7495b 100644 --- a/llvm/lib/Support/Parallel.cpp +++ b/llvm/lib/Support/Parallel.cpp @@ -127,7 +127,7 @@ Executor *Executor::getDefaultExecutor() { #endif } -void detail::TaskGroup::spawn(std::function F) { +void parallel::detail::TaskGroup::spawn(std::function F) { L.inc(); Executor::getDefaultExecutor()->add([&, F] { F(); -- 2.7.4