llvm.org GIT mirror llvm / aa21e41
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145869 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 8 years ago
2 changed file(s) with 5 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2626 #define LLVM_ADT_STATISTIC_H
2727
2828 #include "llvm/Support/Atomic.h"
29 #include "llvm/Support/Valgrind.h"
2930
3031 namespace llvm {
3132 class raw_ostream;
109110 bool tmp = Initialized;
110111 sys::MemoryFence();
111112 if (!tmp) RegisterStatistic();
113 TsanHappensAfter(this);
112114 return *this;
113115 }
114116 void RegisterStatistic();
7272 if (Enabled)
7373 StatInfo->addStatistic(this);
7474
75 TsanHappensBefore(this);
7576 sys::MemoryFence();
7677 // Remember we have been registered.
78 TsanIgnoreWritesBegin();
7779 Initialized = true;
80 TsanIgnoreWritesEnd();
7881 }
7982 }
8083