]> granicus.if.org Git - llvm/commitdiff
[ResetMachineFunctionPass] Add visited functions statistics info
authorCraig Topper <craig.topper@intel.com>
Thu, 14 Mar 2019 01:13:15 +0000 (01:13 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 14 Mar 2019 01:13:15 +0000 (01:13 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356114 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/ResetMachineFunctionPass.cpp

index 2e5ff23b4f81aeb7a246f18f82fe2e913ea3b32d..019de6554d2af09d767b1a4fc35dba34964f1317 100644 (file)
@@ -26,6 +26,7 @@ using namespace llvm;
 #define DEBUG_TYPE "reset-machine-function"
 
 STATISTIC(NumFunctionsReset, "Number of functions reset");
+STATISTIC(NumFunctionsVisited, "Number of functions visited");
 
 namespace {
   class ResetMachineFunction : public MachineFunctionPass {
@@ -50,6 +51,7 @@ namespace {
     }
 
     bool runOnMachineFunction(MachineFunction &MF) override {
+      ++NumFunctionsVisited;
       // 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
       // disappear.