Message ID | d22bd407-677c-5929-8c4b-248347b39154@suse.cz |
---|---|
State | New |
Headers | show |
Series | Remove reduntant dumps and make tp_first_run dump more compact. | expand |
> Hi. > > I've noticed a redundancy in cgraph_node dump function and I would like to simplify > and compact how Function flags are printed. Plus I moved 'First run' to the flags > as well. One diff example: > > @@ -133,8 +125,7 @@ > Referring: > Availability: available > Profile id: 108032747 > - First run: 6 > - Function flags: count: 1 body only_called_at_startup nonfreeing_fn only_called_at_startup > + Function flags: count:1 first_run:6 body only_called_at_startup nonfreeing_fn > Called by: > Calls: > g/0 (g) @0x7ffff6ad8000 > > Patch survives regression tests on x86_64-linux-gnu. > Ready for trunk? OK, thanks! Honza > Thanks, > Martin > > gcc/ChangeLog: > > 2018-10-23 Martin Liska <mliska@suse.cz> > > * cgraph.c (cgraph_node::dump): > Remove reduntant dumps and make tp_first_run dump more compact. > > libgcc/ChangeLog: > > 2018-10-23 Martin Liska <mliska@suse.cz> > > * libgcov-profiler.c: Start from 1 in order to distinguish > functions which were seen and these that were not. > --- > gcc/cgraph.c | 15 ++++++--------- > gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c | 2 +- > gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c | 4 ++-- > gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c | 2 +- > libgcc/libgcov-profiler.c | 2 +- > 5 files changed, 11 insertions(+), 14 deletions(-) > > > diff --git a/gcc/cgraph.c b/gcc/cgraph.c > index 48bab9f2749..b432f7e6500 100644 > --- a/gcc/cgraph.c > +++ b/gcc/cgraph.c > @@ -2016,7 +2016,6 @@ cgraph_node::dump (FILE *f) > if (profile_id) > fprintf (f, " Profile id: %i\n", > profile_id); > - fprintf (f, " First run: %i\n", tp_first_run); > cgraph_function_version_info *vi = function_version (); > if (vi != NULL) > { > @@ -2040,11 +2039,13 @@ cgraph_node::dump (FILE *f) > fprintf (f, " Function flags:"); > if (count.initialized_p ()) > { > - fprintf (f, " count: "); > + fprintf (f, " count:"); > count.dump (f); > } > + if (tp_first_run > 0) > + fprintf (f, " first_run:%i", tp_first_run); > if (origin) > - fprintf (f, " nested in: %s", origin->asm_name ()); > + fprintf (f, " nested in:%s", origin->asm_name ()); > if (gimple_has_body_p (decl)) > fprintf (f, " body"); > if (process) > @@ -2081,10 +2082,6 @@ cgraph_node::dump (FILE *f) > fprintf (f, " unlikely_executed"); > if (frequency == NODE_FREQUENCY_EXECUTED_ONCE) > fprintf (f, " executed_once"); > - if (only_called_at_startup) > - fprintf (f, " only_called_at_startup"); > - if (only_called_at_exit) > - fprintf (f, " only_called_at_exit"); > if (opt_for_fn (decl, optimize_size)) > fprintf (f, " optimize_size"); > if (parallelized_function) > @@ -2096,7 +2093,7 @@ cgraph_node::dump (FILE *f) > { > fprintf (f, " Thunk"); > if (thunk.alias) > - fprintf (f, " of %s (asm: %s)", > + fprintf (f, " of %s (asm:%s)", > lang_hooks.decl_printable_name (thunk.alias, 2), > IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk.alias))); > fprintf (f, " fixed offset %i virtual value %i indirect_offset %i " > @@ -2112,7 +2109,7 @@ cgraph_node::dump (FILE *f) > fprintf (f, " Alias of %s", > lang_hooks.decl_printable_name (thunk.alias, 2)); > if (DECL_ASSEMBLER_NAME_SET_P (thunk.alias)) > - fprintf (f, " (asm: %s)", > + fprintf (f, " (asm:%s)", > IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk.alias))); > fprintf (f, "\n"); > } > diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c > index 455f923f3f4..a622df23ce6 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c > @@ -16,6 +16,6 @@ int main () > { > return foo (); > } > -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 1 "profile"} } */ > /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */ > /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */ > +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */ > diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c > index e6eaeb99810..497b585388e 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c > @@ -43,7 +43,7 @@ int main () > > return r; > } > -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 2 "profile"} } */ > -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */ > +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 2 "profile"} } */ > /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */ > /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */ > +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 4" 1 "profile"} } */ > diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c > index 69ce0260828..69daf237483 100644 > --- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c > +++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c > @@ -17,6 +17,6 @@ int main () > { > return foo (); > } > -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 1 "profile"} } */ > /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */ > /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */ > +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */ > diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c > index 7a5e50009ce..47c00ee4b4a 100644 > --- a/libgcc/libgcov-profiler.c > +++ b/libgcc/libgcov-profiler.c > @@ -335,7 +335,7 @@ __gcov_indirect_call_profiler_v2 (gcov_type value, void* cur_func) > #ifdef L_gcov_time_profiler > > /* Counter for first visit of each function. */ > -gcov_type __gcov_time_profiler_counter ATTRIBUTE_HIDDEN; > +gcov_type __gcov_time_profiler_counter ATTRIBUTE_HIDDEN = 1; > > #endif > >
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 48bab9f2749..b432f7e6500 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2016,7 +2016,6 @@ cgraph_node::dump (FILE *f) if (profile_id) fprintf (f, " Profile id: %i\n", profile_id); - fprintf (f, " First run: %i\n", tp_first_run); cgraph_function_version_info *vi = function_version (); if (vi != NULL) { @@ -2040,11 +2039,13 @@ cgraph_node::dump (FILE *f) fprintf (f, " Function flags:"); if (count.initialized_p ()) { - fprintf (f, " count: "); + fprintf (f, " count:"); count.dump (f); } + if (tp_first_run > 0) + fprintf (f, " first_run:%i", tp_first_run); if (origin) - fprintf (f, " nested in: %s", origin->asm_name ()); + fprintf (f, " nested in:%s", origin->asm_name ()); if (gimple_has_body_p (decl)) fprintf (f, " body"); if (process) @@ -2081,10 +2082,6 @@ cgraph_node::dump (FILE *f) fprintf (f, " unlikely_executed"); if (frequency == NODE_FREQUENCY_EXECUTED_ONCE) fprintf (f, " executed_once"); - if (only_called_at_startup) - fprintf (f, " only_called_at_startup"); - if (only_called_at_exit) - fprintf (f, " only_called_at_exit"); if (opt_for_fn (decl, optimize_size)) fprintf (f, " optimize_size"); if (parallelized_function) @@ -2096,7 +2093,7 @@ cgraph_node::dump (FILE *f) { fprintf (f, " Thunk"); if (thunk.alias) - fprintf (f, " of %s (asm: %s)", + fprintf (f, " of %s (asm:%s)", lang_hooks.decl_printable_name (thunk.alias, 2), IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk.alias))); fprintf (f, " fixed offset %i virtual value %i indirect_offset %i " @@ -2112,7 +2109,7 @@ cgraph_node::dump (FILE *f) fprintf (f, " Alias of %s", lang_hooks.decl_printable_name (thunk.alias, 2)); if (DECL_ASSEMBLER_NAME_SET_P (thunk.alias)) - fprintf (f, " (asm: %s)", + fprintf (f, " (asm:%s)", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk.alias))); fprintf (f, "\n"); } diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c index 455f923f3f4..a622df23ce6 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c @@ -16,6 +16,6 @@ int main () { return foo (); } -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 1 "profile"} } */ /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */ /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c index e6eaeb99810..497b585388e 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c +++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c @@ -43,7 +43,7 @@ int main () return r; } -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 2 "profile"} } */ -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 2 "profile"} } */ /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */ /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 4" 1 "profile"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c index 69ce0260828..69daf237483 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c +++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c @@ -17,6 +17,6 @@ int main () { return foo (); } -/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 1 "profile"} } */ /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */ /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */ diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c index 7a5e50009ce..47c00ee4b4a 100644 --- a/libgcc/libgcov-profiler.c +++ b/libgcc/libgcov-profiler.c @@ -335,7 +335,7 @@ __gcov_indirect_call_profiler_v2 (gcov_type value, void* cur_func) #ifdef L_gcov_time_profiler /* Counter for first visit of each function. */ -gcov_type __gcov_time_profiler_counter ATTRIBUTE_HIDDEN; +gcov_type __gcov_time_profiler_counter ATTRIBUTE_HIDDEN = 1; #endif