diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-12-05 23:07:05 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-12-05 23:07:05 +0000 |
commit | 897a57ecdaee7cbc0c45414ec8b5df733d0c46ac (patch) | |
tree | 21b00968102cf02c5501e972229c124065ec2c82 | |
parent | db66ed0e4cabe111f11732240e72bfdf650edefe (diff) | |
download | bcm5719-llvm-897a57ecdaee7cbc0c45414ec8b5df733d0c46ac.tar.gz bcm5719-llvm-897a57ecdaee7cbc0c45414ec8b5df733d0c46ac.zip |
Silence tsan false-positives (tsan can't track things which are only safe due to
memory fences) in statistics registration, which works the same way that
ManagedStatic registration does.
llvm-svn: 145869
-rw-r--r-- | llvm/include/llvm/ADT/Statistic.h | 2 | ||||
-rw-r--r-- | llvm/lib/Support/Statistic.cpp | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h index b8a1a2f5c4e..b54d10b9dd3 100644 --- a/llvm/include/llvm/ADT/Statistic.h +++ b/llvm/include/llvm/ADT/Statistic.h @@ -27,6 +27,7 @@ #define LLVM_ADT_STATISTIC_H #include "llvm/Support/Atomic.h" +#include "llvm/Support/Valgrind.h" namespace llvm { class raw_ostream; @@ -110,6 +111,7 @@ protected: bool tmp = Initialized; sys::MemoryFence(); if (!tmp) RegisterStatistic(); + TsanHappensAfter(this); return *this; } void RegisterStatistic(); diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp index 04a44a0f711..d8a6ad35ba9 100644 --- a/llvm/lib/Support/Statistic.cpp +++ b/llvm/lib/Support/Statistic.cpp @@ -73,9 +73,12 @@ void Statistic::RegisterStatistic() { if (Enabled) StatInfo->addStatistic(this); + TsanHappensBefore(this); sys::MemoryFence(); // Remember we have been registered. + TsanIgnoreWritesBegin(); Initialized = true; + TsanIgnoreWritesEnd(); } } |