]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: add timevar values for supergraph manipulation [PR123145]
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 16 Jan 2026 15:54:31 +0000 (10:54 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 16 Jan 2026 15:54:31 +0000 (10:54 -0500)
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.

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 <dmalcolm@redhat.com>
gcc/analyzer/supergraph-fixup-locations.cc
gcc/analyzer/supergraph-simplify.cc
gcc/analyzer/supergraph-sorting.cc
gcc/analyzer/supergraph.cc
gcc/timevar.def

index cf4aa793e23f7091e2cabf2f633451c293b34114..54555164692a8a289d6db9b60e9f099d21220b52 100644 (file)
@@ -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);
index 9a5fcd341462f7317f1df2d683f8341f0ebba3db..3037d9c105ab3f803f7c4effa9d58f77fa2a779e 100644 (file)
@@ -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);
 
   {
index 829daa69d33fad1bb3238d55f54c82b3a0403e94..2d87e26685a19c2f60daa214bb9c51cb10635299 100644 (file)
@@ -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);
index 33de07fa2d7d26301fe5b9432086ce7817b57161..81b337fd7ff1e0d8fb921dac4982cedc95a7f23f 100644 (file)
@@ -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.  */
index cd7b08db6460fbb37c5e92b8f25392debf28a4d9..3824caa01bc2c8bf1261fb252ffc1487f209ee10 100644 (file)
@@ -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")