aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/PassSupport.h
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-12-08 00:15:41 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-12-08 00:15:41 +0000
commit7bf7fecd8d76aa7e6bbc336f80c6906cf3498b16 (patch)
tree795acc768ead642057161335596efd8a0c950bf7 /include/llvm/PassSupport.h
parent14d622dce651481c15e652e1595a9df01717ddd7 (diff)
downloadexternal_llvm-7bf7fecd8d76aa7e6bbc336f80c6906cf3498b16.zip
external_llvm-7bf7fecd8d76aa7e6bbc336f80c6906cf3498b16.tar.gz
external_llvm-7bf7fecd8d76aa7e6bbc336f80c6906cf3498b16.tar.bz2
Add Tsan annotations to the pass system.
Perhaps once(&func) should be hoisted into lib/Support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146110 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/PassSupport.h')
-rw-r--r--include/llvm/PassSupport.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h
index 0827909..c50c2cc 100644
--- a/include/llvm/PassSupport.h
+++ b/include/llvm/PassSupport.h
@@ -25,6 +25,7 @@
#include "llvm/PassRegistry.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/Atomic.h"
+#include "llvm/Support/Valgrind.h"
#include <vector>
namespace llvm {
@@ -135,7 +136,10 @@ private:
if (old_val == 0) { \
function(Registry); \
sys::MemoryFence(); \
+ TsanIgnoreWritesBegin(); \
+ TsanHappensBefore(&initialized); \
initialized = 2; \
+ TsanIgnoreWritesEnd(); \
} else { \
sys::cas_flag tmp = initialized; \
sys::MemoryFence(); \
@@ -143,7 +147,8 @@ private:
tmp = initialized; \
sys::MemoryFence(); \
} \
- }
+ } \
+ TsanHappensAfter(&initialized);
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \
static void* initialize##passName##PassOnce(PassRegistry &Registry) { \