[llvm-commits] [llvm] r145869 - in /llvm/trunk: include/llvm/ADT/Statistic.h lib/Support/Statistic.cpp
Nick Lewycky
nicholas at mxc.ca
Mon Dec 5 15:07:06 PST 2011
Author: nicholas
Date: Mon Dec 5 17:07:05 2011
New Revision: 145869
URL: http://llvm.org/viewvc/llvm-project?rev=145869&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/ADT/Statistic.h
llvm/trunk/lib/Support/Statistic.cpp
Modified: llvm/trunk/include/llvm/ADT/Statistic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Statistic.h?rev=145869&r1=145868&r2=145869&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Statistic.h (original)
+++ llvm/trunk/include/llvm/ADT/Statistic.h Mon Dec 5 17:07:05 2011
@@ -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 @@
bool tmp = Initialized;
sys::MemoryFence();
if (!tmp) RegisterStatistic();
+ TsanHappensAfter(this);
return *this;
}
void RegisterStatistic();
Modified: llvm/trunk/lib/Support/Statistic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Statistic.cpp?rev=145869&r1=145868&r2=145869&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Statistic.cpp (original)
+++ llvm/trunk/lib/Support/Statistic.cpp Mon Dec 5 17:07:05 2011
@@ -73,9 +73,12 @@
if (Enabled)
StatInfo->addStatistic(this);
+ TsanHappensBefore(this);
sys::MemoryFence();
// Remember we have been registered.
+ TsanIgnoreWritesBegin();
Initialized = true;
+ TsanIgnoreWritesEnd();
}
}
More information about the llvm-commits
mailing list