projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set REQUIRES shell on the test cases for r186044
[oota-llvm.git]
/
lib
/
Support
/
ManagedStatic.cpp
diff --git
a/lib/Support/ManagedStatic.cpp
b/lib/Support/ManagedStatic.cpp
index 4e655a0f9eec461b9a41c8f4c72104859275d6ac..098cccb68df51880522f63ff520fccf57e4ba0b9 100644
(file)
--- a/
lib/Support/ManagedStatic.cpp
+++ b/
lib/Support/ManagedStatic.cpp
@@
-13,7
+13,7
@@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Config/config.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Config/config.h"
-#include "llvm/S
ystem
/Atomic.h"
+#include "llvm/S
upport
/Atomic.h"
#include <cassert>
using namespace llvm;
#include <cassert>
using namespace llvm;
@@
-27,8
+27,15
@@
void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
if (Ptr == 0) {
void* tmp = Creator ? Creator() : 0;
if (Ptr == 0) {
void* tmp = Creator ? Creator() : 0;
+ TsanHappensBefore(this);
sys::MemoryFence();
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;
Ptr = tmp;
+ TsanIgnoreWritesEnd();
DeleterFn = Deleter;
// Add to list of managed statics.
DeleterFn = Deleter;
// Add to list of managed statics.
@@
-72,4
+79,3
@@
void llvm::llvm_shutdown() {
if (llvm_is_multithreaded()) llvm_stop_multithreaded();
}
if (llvm_is_multithreaded()) llvm_stop_multithreaded();
}
-