]> granicus.if.org Git - llvm/commitdiff
[ScheduleDAG] Add statistics for maintaining the topological order.
authorFlorian Hahn <flo@fhahn.com>
Wed, 10 Apr 2019 09:03:03 +0000 (09:03 +0000)
committerFlorian Hahn <flo@fhahn.com>
Wed, 10 Apr 2019 09:03:03 +0000 (09:03 +0000)
This is helpful to measure the impact of D60125 on maintaining
topological orders.

Reviewers: MatzeB, atrick, efriedma, niravd

Reviewed By: efriedma

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

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

lib/CodeGen/ScheduleDAG.cpp

index 8ebe8fa6bd63c07ef9aa9b392d826fead749d982..5294c5b1c2c7da6b592517e6de39ea5b20ad9b87 100644 (file)
@@ -14,6 +14,7 @@
 #include "llvm/CodeGen/ScheduleDAG.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/ScheduleHazardRecognizer.h"
@@ -37,6 +38,10 @@ using namespace llvm;
 
 #define DEBUG_TYPE "pre-RA-sched"
 
+STATISTIC(NumNewPredsAdded, "Number of times a  single predecessor was added");
+STATISTIC(NumTopoInits,
+          "Number of times the topological order has been recomputed");
+
 #ifndef NDEBUG
 static cl::opt<bool> StressSchedOpt(
   "stress-sched", cl::Hidden, cl::init(false),
@@ -497,6 +502,7 @@ void ScheduleDAGTopologicalSort::InitDAGTopologicalSorting() {
   }
 
   Visited.resize(DAGSize);
+  NumTopoInits++;
 
 #ifndef NDEBUG
   // Check correctness of the ordering
@@ -523,6 +529,8 @@ void ScheduleDAGTopologicalSort::AddPred(SUnit *Y, SUnit *X) {
     // Recompute topological indexes.
     Shift(Visited, LowerBound, UpperBound);
   }
+
+  NumNewPredsAdded++;
 }
 
 void ScheduleDAGTopologicalSort::RemovePred(SUnit *M, SUnit *N) {