[ResetMachineFunctionPass] Add visited functions statistics info

Adding a "NumFunctionsVisited" for collecting the visited function number.
It can be used to collect function pass rate in some tests,
the pass rate = (NumberVisited - NumberReset)/NumberVisited.
e.g. it can be used for caculating GlobalISel pass rate in Test-Suite.

Patch by Tianyang Zhu (zhutianyang)

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

llvm-svn: 356114
This commit is contained in:
Craig Topper 2019-03-14 01:13:15 +00:00
parent 23b37bf362
commit 66df7361ff
1 changed files with 2 additions and 0 deletions

View File

@ -26,6 +26,7 @@ using namespace llvm;
#define DEBUG_TYPE "reset-machine-function" #define DEBUG_TYPE "reset-machine-function"
STATISTIC(NumFunctionsReset, "Number of functions reset"); STATISTIC(NumFunctionsReset, "Number of functions reset");
STATISTIC(NumFunctionsVisited, "Number of functions visited");
namespace { namespace {
class ResetMachineFunction : public MachineFunctionPass { class ResetMachineFunction : public MachineFunctionPass {
@ -50,6 +51,7 @@ namespace {
} }
bool runOnMachineFunction(MachineFunction &MF) override { bool runOnMachineFunction(MachineFunction &MF) override {
++NumFunctionsVisited;
// No matter what happened, whether we successfully selected the function // No matter what happened, whether we successfully selected the function
// or not, nothing is going to use the vreg types after us. Make sure they // or not, nothing is going to use the vreg types after us. Make sure they
// disappear. // disappear.