9 Commits

Author SHA1 Message Date
Zhizhou Yang
1bbd49ae6f Print out DebugCounter info with -print-debug-counter
Summary:
This patch will print out {Counter, Skip, StopAfter} info of all passes which have DebugCounter set at destruction.

It can be used to monitor how many times does certain transformation happen in a pass, and also help check if -debug-counter option is set correctly.

Please refer to this [[ http://lists.llvm.org/pipermail/llvm-dev/2018-July/124722.html  | thread ]] for motivation.

Reviewers: george.burgess.iv, davide, greened

Reviewed By: greened

Subscribers: kristina, llozano, mgorny, llvm-commits, mgrang

Differential Revision: https://reviews.llvm.org/D50031

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345085 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 21:51:56 +00:00
George Burgess IV
68cedc8ad5 [DebugCounters] don't do redundant map lookups; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340104 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-17 22:34:04 +00:00
George Burgess IV
fbf5dde96b [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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338762 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-02 19:50:27 +00:00
George Burgess IV
4f40986a05 [DebugCounters] Keep track of total counts
This patch makes debug counters keep track of the total number of times
we've called `shouldExecute` for each counter, so it's easier to build
automated tooling on top of these.

A patch to print these counts is coming soon.

Patch by Zhizhou Yang!

Differential Revision: https://reviews.llvm.org/D49560


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337748 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 21:49:36 +00:00
Craig Topper
83a5c73d5a [DebugCounter] Make -debug-counter cl::Hidden.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328948 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-01 22:16:52 +00:00
Frederich Munch
e49b209a9e Hide dbgs() stream for when built with -fmodules.
Summary: Make DebugCounter::print and dump methods to be const correct.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34214

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305408 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 19:16:22 +00:00
Benjamin Kramer
a0f27f968e Make helper functions static. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304029 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-26 20:09:00 +00:00
Daniel Berlin
392cb33de1 DebugCounter: Initialize skip to 0, not -1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-04 14:08:47 +00:00
Daniel Berlin
8b1bda0af6 Add two files lost in rebase, causing build break
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295595 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 04:29:50 +00:00