summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/ManagedStatic.cpp3
-rw-r--r--llvm/lib/Support/Statistic.cpp2
-rw-r--r--llvm/lib/Support/Threading.cpp6
-rw-r--r--llvm/lib/Support/Timer.cpp4
4 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp
index 098cccb68df..c19f8cb4859 100644
--- a/llvm/lib/Support/ManagedStatic.cpp
+++ b/llvm/lib/Support/ManagedStatic.cpp
@@ -13,7 +13,6 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Config/config.h"
-#include "llvm/Support/Atomic.h"
#include <cassert>
using namespace llvm;
@@ -28,7 +27,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
void* tmp = Creator ? Creator() : 0;
TsanHappensBefore(this);
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
// This write is racy against the first read in the ManagedStatic
// accessors. The race is benign because it does a second read after a
diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp
index 56c3b0f5659..9d075736b30 100644
--- a/llvm/lib/Support/Statistic.cpp
+++ b/llvm/lib/Support/Statistic.cpp
@@ -76,7 +76,7 @@ void Statistic::RegisterStatistic() {
StatInfo->addStatistic(this);
TsanHappensBefore(this);
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
// Remember we have been registered.
TsanIgnoreWritesBegin();
Initialized = true;
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index 9d7ac6c18de..15dd8a98052 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -13,8 +13,8 @@
#include "llvm/Support/Threading.h"
#include "llvm/Config/config.h"
-#include "llvm/Support/Atomic.h"
#include "llvm/Support/Mutex.h"
+#include <atomic>
#include <cassert>
using namespace llvm;
@@ -31,7 +31,7 @@ bool llvm::llvm_start_multithreaded() {
// We fence here to ensure that all initialization is complete BEFORE we
// return from llvm_start_multithreaded().
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
return true;
#else
return false;
@@ -44,7 +44,7 @@ void llvm::llvm_stop_multithreaded() {
// We fence here to insure that all threaded operations are complete BEFORE we
// return from llvm_stop_multithreaded().
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
multithreaded_mode = false;
delete global_lock;
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index 0456f5d6383..03845f21f2d 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -81,14 +81,14 @@ raw_ostream *llvm::CreateInfoOutputFile() {
static TimerGroup *DefaultTimerGroup = 0;
static TimerGroup *getDefaultTimerGroup() {
TimerGroup *tmp = DefaultTimerGroup;
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
if (tmp) return tmp;
llvm_acquire_global_lock();
tmp = DefaultTimerGroup;
if (!tmp) {
tmp = new TimerGroup("Miscellaneous Ungrouped Timers");
- sys::MemoryFence();
+ std::atomic_thread_fence(std::memory_order_seq_cst);
DefaultTimerGroup = tmp;
}
llvm_release_global_lock();
OpenPOWER on IntegriCloud