diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-08-03 10:23:43 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-08-03 10:23:43 +0000 |
commit | 6d8abb071814d17f829956e153e719c9d98ca76a (patch) | |
tree | a20a7d5caabc6242dec38b6671d7f85efb929bb6 /llvm/lib/Support/DebugCounter.cpp | |
parent | 91764583f235edaa719c4c1808a9dc9fc4c9db37 (diff) | |
download | bcm5719-llvm-6d8abb071814d17f829956e153e719c9d98ca76a.tar.gz bcm5719-llvm-6d8abb071814d17f829956e153e719c9d98ca76a.zip |
Merging r338762:
------------------------------------------------------------------------
r338762 | gbiv | 2018-08-02 21:50:27 +0200 (Thu, 02 Aug 2018) | 15 lines
[Support] Add an enable bit to our DebugCounters
r337748 made us start incrementing DebugCounters all of the time. This
makes tsan unhappy in multithreaded environments.
Since it doesn't make much sense to use DebugCounters with multiple
threads, this patch makes us only count anything if the user passed a
-debug-counter option or if some other piece of code explicitly asks
for it (e.g. the pass in D50031).
The amount of global state here makes writing a unittest for this
behavior somewhat awkward. So, no test is provided.
Differential Revision: https://reviews.llvm.org/D50150
------------------------------------------------------------------------
llvm-svn: 338846
Diffstat (limited to 'llvm/lib/Support/DebugCounter.cpp')
-rw-r--r-- | llvm/lib/Support/DebugCounter.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp index 5a9cecfc56d..9c12de0776a 100644 --- a/llvm/lib/Support/DebugCounter.cpp +++ b/llvm/lib/Support/DebugCounter.cpp @@ -82,6 +82,7 @@ void DebugCounter::push_back(const std::string &Val) { << " is not a registered counter\n"; return; } + enableAllCounters(); Counters[CounterID].Skip = CounterVal; Counters[CounterID].IsSet = true; } else if (CounterPair.first.endswith("-count")) { @@ -92,6 +93,7 @@ void DebugCounter::push_back(const std::string &Val) { << " is not a registered counter\n"; return; } + enableAllCounters(); Counters[CounterID].StopAfter = CounterVal; Counters[CounterID].IsSet = true; } else { |