This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Port value profiling to -fopt-info infrastructure.


On Thu, Aug 8, 2019 at 4:17 PM Jeff Law <law@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  <mliska@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  <mliska@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).

Richard.

> OK with or without that adjustment.
>
> Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]