summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-11 00:18:52 +0000
committerZachary Turner <zturner@google.com>2017-05-11 00:18:52 +0000
commit20c8e9192d6ecb27e8031eed737bcfe1c02106c6 (patch)
treea8fe12eb4b88b2c5711ebcd70a925e093d0f6d53 /llvm
parent97a2cdbff3df10f032f99bf3306fd5dd2c5d4cd1 (diff)
downloadbcm5719-llvm-20c8e9192d6ecb27e8031eed737bcfe1c02106c6.tar.gz
bcm5719-llvm-20c8e9192d6ecb27e8031eed737bcfe1c02106c6.zip
Try again to fix the buildbots.
TaskGroup and Latch need to be in llvm::parallel::detail, not in llvm::detail. llvm-svn: 302751
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Support/Parallel.h43
-rw-r--r--llvm/lib/Support/Parallel.cpp2
2 files changed, 21 insertions, 24 deletions
diff --git a/llvm/include/llvm/Support/Parallel.h b/llvm/include/llvm/Support/Parallel.h
index 12cabcbea57..e36e0cc29e1 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 <typename T>
+struct is_execution_policy
+ : public std::integral_constant<
+ bool, llvm::is_one_of<T, sequential_execution_policy,
+ parallel_execution_policy>::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 <typename T>
-struct is_execution_policy
- : public std::integral_constant<
- bool, llvm::is_one_of<T, sequential_execution_policy,
- parallel_execution_policy>::value> {};
-
-constexpr sequential_execution_policy seq{};
-constexpr parallel_execution_policy par{};
-
-namespace detail {
-
-#if LLVM_ENABLE_THREADS
#if defined(_MSC_VER)
template <class RandomAccessIterator, class Comparator>
@@ -117,8 +115,7 @@ RandomAccessIterator medianOf3(RandomAccessIterator Start,
template <class RandomAccessIterator, class Comparator>
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 <class RandomAccessIterator, class Comparator>
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 15da66cbe80..3f7495b44f7 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<void()> F) {
+void parallel::detail::TaskGroup::spawn(std::function<void()> F) {
L.inc();
Executor::getDefaultExecutor()->add([&, F] {
F();
OpenPOWER on IntegriCloud