On Fri, Apr 5, 2019 at 2:32 PM Martin Liška <mli...@suse.cz> wrote:
>
> Hi.
>
> The patch adds support for profile for GIMPLE FE. That can be useful
> in the future.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed after stage1 opens?

Hmm, I guess to be useful we need the profile quality indicators as well
(and think about a proper syntax here since it seems related).

Btw, do BB counts and edge probabilities not have a relation?  If so why
do we need both?  In predict.c we also look at ENTRY_BLOCK->count
so we need a place to set that as well.  We should probably set
edge probabilities of fallthru edges properly during our "CFG build".

+    goto __BB3(44739243);

since we eventually want to add other flags this syntactically
should maybe be goto __BB3(guessed(44739243)); and similar
for the __BB count case (just s/count/quality/).

The entry block count could be sticked to __GIMPLE (ssa,guessed(N))
for example.  There's also the exit block, not sure if we ever look at
its count, so __GIMPLE (ssa,guessed(N[,M])) might be a possibility
if we always have the same quality here (probably not...).

Otherwise thanks for trying ;)

Richard.

> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> 2019-04-05  Martin Liska  <mli...@suse.cz>
>
>         * gimple-pretty-print.c (dump_gimple_bb_header):
>         Dump BB count.
>         (pp_cfg_jump): Dump edge probability.
>         * profile-count.h (get_raw_value): New function.
>         (from_raw_value): Likewise.
>
> gcc/c/ChangeLog:
>
> 2019-04-05  Martin Liska  <mli...@suse.cz>
>
>         * gimple-parser.c (struct gimple_parser): Add frequency
>         for gimple_parser_edge.
>         (gimple_parser::push_edge): Add new argument frequency.
>         (c_parser_gimple_parse_bb_spec): Parse also frequency
>         if present.
>         (c_parser_parse_gimple_body): Set edge probability.
>         (c_parser_gimple_compound_statement): Consume token
>         before calling c_parser_gimple_goto_stmt.
>         Parse BB counts.
>         (c_parser_gimple_statement): Pass new argument.
>         (c_parser_gimple_goto_stmt): Likewise.
>         (c_parser_gimple_if_stmt): Likewise.
>
> gcc/testsuite/ChangeLog:
>
> 2019-04-05  Martin Liska  <mli...@suse.cz>
>
>         * gcc.dg/gimplefe-37.c: New test.
> ---
>  gcc/c/gimple-parser.c              | 116 +++++++++++++++++++++++------
>  gcc/gimple-pretty-print.c          |   8 ++
>  gcc/profile-count.h                |  15 ++++
>  gcc/testsuite/gcc.dg/gimplefe-37.c |  27 +++++++
>  4 files changed, 144 insertions(+), 22 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.dg/gimplefe-37.c
>
>

Reply via email to