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.

OK with or without that adjustment.

Jeff

Reply via email to