Whilst tracking down the slowdown of PR analyzer/123145, I noticed that
the various supergraph manipulations introduced in
r16-6063-g0b786d961d4426 can take non-trivial amounts of time on
complicated TUs. Add timevars to track each of them.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r16-6823-gb5df409996260a.
gcc/analyzer/ChangeLog:
PR analyzer/123145
* supergraph-fixup-locations.cc: Include "timevar.h".
(supergraph::fixup_locations): Track time spent as
TV_ANALYZER_SUPERGRAPH_FIXUP_LOCATIONS.
* supergraph-simplify.cc: Include "timevar.h".
(supergraph::simplify): Track time spent as
TV_ANALYZER_SUPERGRAPH_SIMPLIFY.
* supergraph-sorting.cc: Include "timevar.h".
(supergraph::sort_nodes): Track time spent as
TV_ANALYZER_SUPERGRAPH_SORTING.
* supergraph.cc (supergraph::supergraph): Track time spent as
TV_ANALYZER_SUPERGRAPH_CREATION rather than
TV_ANALYZER_SUPERGRAPH.
gcc/ChangeLog:
PR analyzer/123145
* timevar.def (TV_ANALYZER_SUPERGRAPH): Rename to...
(TV_ANALYZER_SUPERGRAPH_CREATION): ...this.
(TV_ANALYZER_SUPERGRAPH_FIXUP_LOCATIONS): New.
(TV_ANALYZER_SUPERGRAPH_SIMPLIFY): New.
(TV_ANALYZER_SUPERGRAPH_SORTING): New.
Signed-off-by: David Malcolm <[email protected]>
---
gcc/analyzer/supergraph-fixup-locations.cc | 3 +++
gcc/analyzer/supergraph-simplify.cc | 2 ++
gcc/analyzer/supergraph-sorting.cc | 2 ++
gcc/analyzer/supergraph.cc | 3 +--
gcc/timevar.def | 5 ++++-
5 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/gcc/analyzer/supergraph-fixup-locations.cc
b/gcc/analyzer/supergraph-fixup-locations.cc
index cf4aa793e23..54555164692 100644
--- a/gcc/analyzer/supergraph-fixup-locations.cc
+++ b/gcc/analyzer/supergraph-fixup-locations.cc
@@ -21,6 +21,8 @@ along with GCC; see the file COPYING3. If not see
#define INCLUDE_DEQUE
#include "analyzer/common.h"
+#include "timevar.h"
+
#include "analyzer/supergraph.h"
#include "analyzer/analyzer-logging.h"
#include "analyzer/supergraph-manipulation.h"
@@ -108,6 +110,7 @@ private:
void
supergraph::fixup_locations (logger *logger)
{
+ auto_timevar tv (TV_ANALYZER_SUPERGRAPH_FIXUP_LOCATIONS);
LOG_SCOPE (logger);
location_fixer opt (*this, logger);
diff --git a/gcc/analyzer/supergraph-simplify.cc
b/gcc/analyzer/supergraph-simplify.cc
index 9a5fcd34146..3037d9c105a 100644
--- a/gcc/analyzer/supergraph-simplify.cc
+++ b/gcc/analyzer/supergraph-simplify.cc
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "analyzer/common.h"
#include "cgraph.h"
+#include "timevar.h"
#include "analyzer/supergraph.h"
#include "analyzer/analyzer-logging.h"
@@ -293,6 +294,7 @@ supergraph::log_stats (logger *logger) const
void
supergraph::simplify (logger *logger)
{
+ auto_timevar tv (TV_ANALYZER_SUPERGRAPH_SIMPLIFY);
LOG_SCOPE (logger);
{
diff --git a/gcc/analyzer/supergraph-sorting.cc
b/gcc/analyzer/supergraph-sorting.cc
index 829daa69d33..2d87e26685a 100644
--- a/gcc/analyzer/supergraph-sorting.cc
+++ b/gcc/analyzer/supergraph-sorting.cc
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "alloc-pool.h"
#include "fibonacci_heap.h"
+#include "timevar.h"
#include "analyzer/supergraph.h"
#include "analyzer/analyzer-logging.h"
@@ -254,6 +255,7 @@ get_node_ordering (const supergraph &sg,
void
supergraph::sort_nodes (logger *logger)
{
+ auto_timevar tv (TV_ANALYZER_SUPERGRAPH_SORTING);
LOG_SCOPE (logger);
const std::vector<supernode *> ordering = get_node_ordering (*this, logger);
diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index 33de07fa2d7..81b337fd7ff 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -142,8 +142,7 @@ supergraph::supergraph (region_model_manager &mgr,
logger *logger)
: m_next_snode_id (0)
{
- auto_timevar tv (TV_ANALYZER_SUPERGRAPH);
-
+ auto_timevar tv (TV_ANALYZER_SUPERGRAPH_CREATION);
LOG_FUNC (logger);
/* For each BB, if present, the stmt that terminates it. */
diff --git a/gcc/timevar.def b/gcc/timevar.def
index cd7b08db646..3824caa01bc 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -347,7 +347,10 @@ DEFTIMEVAR (TV_JIT_CLIENT_CODE , "JIT client code")
/* Analyzer timevars. */
DEFTIMEVAR (TV_ANALYZER , "analyzer")
-DEFTIMEVAR (TV_ANALYZER_SUPERGRAPH , "analyzer: supergraph")
+DEFTIMEVAR (TV_ANALYZER_SUPERGRAPH_CREATION, "analyzer: supergraph: creation")
+DEFTIMEVAR (TV_ANALYZER_SUPERGRAPH_FIXUP_LOCATIONS, "analyzer: supergraph:
fixup locations")
+DEFTIMEVAR (TV_ANALYZER_SUPERGRAPH_SIMPLIFY, "analyzer: supergraph: simplify")
+DEFTIMEVAR (TV_ANALYZER_SUPERGRAPH_SORTING, "analyzer: supergraph: sorting")
DEFTIMEVAR (TV_ANALYZER_STATE_PURGE , "analyzer: state purge")
DEFTIMEVAR (TV_ANALYZER_PLAN , "analyzer: planning")
DEFTIMEVAR (TV_ANALYZER_SCC , "analyzer: scc")
--
2.26.3