On 8/9/19 10:13 AM, Richard Biener wrote: > On Thu, Aug 8, 2019 at 4:17 PM Jeff Law <l...@redhat.com> wrote: >> >> On 8/8/19 7:04 AM, Martin Liška wrote: >>> Hi. >>> >>> As requested by Richi, I'm suggesting to use new dump_printf >>> optimization info infrastructure. >>> >>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >>> >>> Ready to be installed? >>> Thanks, >>> Martin >>> >>> gcc/ChangeLog: >>> >>> 2019-08-08 Martin Liska <mli...@suse.cz> >>> >>> * value-prof.c (gimple_divmod_fixed_value_transform): >>> Use dump_printf_loc. >>> (gimple_mod_pow2_value_transform): Likewise. >>> (gimple_mod_subtract_transform): Likewise. >>> (init_node_map): Likewise. >>> (gimple_ic_transform): Likewise. >>> (gimple_stringops_transform): Likewise. >>> >>> gcc/testsuite/ChangeLog: >>> >>> 2019-08-08 Martin Liska <mli...@suse.cz> >>> >>> * g++.dg/tree-prof/indir-call-prof.C: Add -optimize >>> to -fdump-ipa-profile. >>> * g++.dg/tree-prof/morefunc.C: Likewise. >>> * g++.dg/tree-prof/reorder.C: Likewise. >>> * gcc.dg/tree-prof/ic-misattribution-1.c: Likewise. >>> * gcc.dg/tree-prof/indir-call-prof.c: Likewise. >>> * gcc.dg/tree-prof/stringop-1.c: Likewise. >>> * gcc.dg/tree-prof/stringop-2.c: Likewise. >>> * gcc.dg/tree-prof/val-prof-1.c: Likewise. >>> * gcc.dg/tree-prof/val-prof-2.c: Likewise. >>> * gcc.dg/tree-prof/val-prof-3.c: Likewise. >>> * gcc.dg/tree-prof/val-prof-4.c: Likewise. >>> * gcc.dg/tree-prof/val-prof-5.c: Likewise. >>> * gcc.dg/tree-prof/val-prof-7.c: Likewise. >>> --- >>> .../g++.dg/tree-prof/indir-call-prof.C | 2 +- >>> diff --git a/gcc/value-prof.c b/gcc/value-prof.c >>> index 759458868a8..9d9785b179d 100644 >>> --- a/gcc/value-prof.c >>> +++ b/gcc/value-prof.c >>> @@ -809,12 +809,9 @@ gimple_divmod_fixed_value_transform >>> (gimple_stmt_iterator *si) >>> @@ -1445,41 +1447,36 @@ gimple_ic_transform (gimple_stmt_iterator *gsi) >> [ ... ] >>> - if (dump_file) >>> + if (dump_enabled_p ()) >>> { >>> - fprintf (dump_file, "Indirect call -> direct call "); >>> - print_generic_expr (dump_file, gimple_call_fn (stmt), TDF_SLIM); >>> - fprintf (dump_file, "=> "); >>> - print_generic_expr (dump_file, direct_call->decl, TDF_SLIM); >>> - fprintf (dump_file, " transformation on insn postponned to >>> ipa-profile"); >>> - print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); >>> - fprintf (dump_file, "hist->count %" PRId64 >>> - " hist->all %" PRId64"\n", count, all); >>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, >>> + "Indirect call -> direct call " >>> + "%T => %T transformation on insn postponed " >>> + "to ipa-profile: %G", gimple_call_fn (stmt), >>> + direct_call->decl, stmt); >>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, >>> + "hist->count %" PRId64 >>> + " hist->all %" PRId64"\n", count, all); >>> } >> It's not entirely clear if you want MSG_OPTIMIZED_LOCATION vs >> MSG_MISSED_OPTIMIZATION here. Double check and adjust if needed. > > But we don't want multi-line stuff here but a single message for > MSG_OPTIMIZED_LOCATION, eventually detail printed with MSG_NOTE. > Can you adjust accordingly, esp. try not dumping GIMPLE stmts for > the non-NOTE message give it is directed at users. So just > > Indirect call -> direct call %T -> %T transformation > > (without the postponed stuff, that's implementation detail not interesting).
Ok, there's a patch that I've just tested. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin > > Richard. > >> OK with or without that adjustment. >> >> Jeff
>From 4eafa3655a6f557d69c2c41e29634a8c805ea8cc Mon Sep 17 00:00:00 2001 From: Martin Liska <mli...@suse.cz> Date: Fri, 9 Aug 2019 14:34:55 +0200 Subject: [PATCH] Simplify dump_printf in value-prof.c gcc/ChangeLog: 2019-08-09 Martin Liska <mli...@suse.cz> * value-prof.c (gimple_ic_transform): Add new line. Print details with MSG_NOTE. gcc/testsuite/ChangeLog: 2019-08-09 Martin Liska <mli...@suse.cz> * gcc.dg/tree-prof/ic-misattribution-1.c: Use -fdump-ipa-profile-node. --- gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c | 2 +- gcc/value-prof.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c b/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c index 126236eba8e..0c69045591b 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile-optimized" } */ +/* { dg-options "-O2 -fdump-ipa-profile-note" } */ /* { dg-additional-sources "ic-misattribution-1a.c" } */ extern void other_caller (void); diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 9d9785b179d..00ede8d985f 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -1450,7 +1450,7 @@ gimple_ic_transform (gimple_stmt_iterator *gsi) if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, stmt, "Indirect call -> direct call from other " - "module %T=> %i (will resolve only with LTO)", + "module %T=> %i (will resolve only with LTO)\n", gimple_call_fn (stmt), (int)val); } return false; @@ -1471,10 +1471,9 @@ gimple_ic_transform (gimple_stmt_iterator *gsi) { dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, "Indirect call -> direct call " - "%T => %T transformation on insn postponed " - "to ipa-profile: %G", gimple_call_fn (stmt), - direct_call->decl, stmt); - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, + "%T => %T transformation on insn postponed\n", + gimple_call_fn (stmt), direct_call->decl); + dump_printf_loc (MSG_NOTE, stmt, "hist->count %" PRId64 " hist->all %" PRId64"\n", count, all); } -- 2.22.0