summaryrefslogtreecommitdiffstats
path: root/lib/Support/ManagedStatic.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-04-14 13:54:10 +0000
committerdim <dim@FreeBSD.org>2012-04-14 13:54:10 +0000
commit1fc08f5e9ef733ef1ce6f363fecedc2260e78974 (patch)
tree19c69a04768629f2d440944b71cbe90adae0b615 /lib/Support/ManagedStatic.cpp
parent07637c87f826cdf411f0673595e9bc92ebd793f2 (diff)
downloadFreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.zip
FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.tar.gz
Vendor import of llvm trunk r154661:
http://llvm.org/svn/llvm-project/llvm/trunk@r154661
Diffstat (limited to 'lib/Support/ManagedStatic.cpp')
-rw-r--r--lib/Support/ManagedStatic.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Support/ManagedStatic.cpp b/lib/Support/ManagedStatic.cpp
index c767c15..098cccb 100644
--- a/lib/Support/ManagedStatic.cpp
+++ b/lib/Support/ManagedStatic.cpp
@@ -27,8 +27,15 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
if (Ptr == 0) {
void* tmp = Creator ? Creator() : 0;
+ TsanHappensBefore(this);
sys::MemoryFence();
+
+ // This write is racy against the first read in the ManagedStatic
+ // accessors. The race is benign because it does a second read after a
+ // memory fence, at which point it isn't possible to get a partial value.
+ TsanIgnoreWritesBegin();
Ptr = tmp;
+ TsanIgnoreWritesEnd();
DeleterFn = Deleter;
// Add to list of managed statics.
@@ -72,4 +79,3 @@ void llvm::llvm_shutdown() {
if (llvm_is_multithreaded()) llvm_stop_multithreaded();
}
-
OpenPOWER on IntegriCloud