This patch adds two variables named 'TV_CGRAPH_FUNC_EXPANSION' and
'TV_CGRAPH_IPA_PASSES' that count the elapsed time of the functions
'expand_all_functions' and 'ipa_passes', respectivelly.

The main point of this is that these functions takes a very long time
when compiling the 'gimple-match.c' file, and therefore may also take
a long time when compiling other large files.

I also accept suggestions about how to improve this :-)

ChangeLog:

2019-01-24      Giuliano Belinassi <giuliano.belina...@usp.br>

        * cgraph_unit.c (compile): TV_CGRAPH_FUNC_EXPANSION and
        TV_CGRAPH_IPA_PASSES start, stop.
        * timevar.def (TV_CGRAPH_IPA_PASSES, TV_CGRAPH_FUNC_EXPANSION): New.


Index: gcc/cgraphunit.c
===================================================================
--- gcc/cgraphunit.c	(revision 267983)
+++ gcc/cgraphunit.c	(working copy)
@@ -2615,8 +2615,11 @@
 
   /* Don't run the IPA passes if there was any error or sorry messages.  */
   if (!seen_error ())
+  {
+    timevar_start (TV_CGRAPH_IPA_PASSES);
     ipa_passes ();
-
+    timevar_stop (TV_CGRAPH_IPA_PASSES);
+  }
   /* Do nothing else if any IPA pass found errors or if we are just streaming LTO.  */
   if (seen_error ()
       || ((!in_lto_p || flag_incremental_link == INCREMENTAL_LINK_LTO)
@@ -2682,7 +2685,11 @@
   /* Output first asm statements and anything ordered. The process
      flag is cleared for these nodes, so we skip them later.  */
   output_in_order ();
+
+  timevar_start (TV_CGRAPH_FUNC_EXPANSION);
   expand_all_functions ();
+  timevar_stop (TV_CGRAPH_FUNC_EXPANSION);
+
   output_variables ();
 
   process_new_functions ();
Index: gcc/timevar.def
===================================================================
--- gcc/timevar.def	(revision 267983)
+++ gcc/timevar.def	(working copy)
@@ -68,6 +68,8 @@
 
 DEFTIMEVAR (TV_CGRAPH                , "callgraph construction")
 DEFTIMEVAR (TV_CGRAPHOPT             , "callgraph optimization")
+DEFTIMEVAR (TV_CGRAPH_FUNC_EXPANSION , "callgraph functions expansion")
+DEFTIMEVAR (TV_CGRAPH_IPA_PASSES     , "callgraph ipa passes")
 DEFTIMEVAR (TV_IPA_FNSUMMARY         , "ipa function summary")
 DEFTIMEVAR (TV_IPA_UNREACHABLE       , "ipa dead code removal")
 DEFTIMEVAR (TV_IPA_INHERITANCE       , "ipa inheritance graph")

Reply via email to