public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Reorgnanization of profile count maintenance code, part 1
Date: Sat, 03 Jun 2017 18:51:00 -0000	[thread overview]
Message-ID: <20170603185121.256e75kqlwhvegdd@nbbrfq.cc.univie.ac.at> (raw)
In-Reply-To: <20170601113556.GH22051@kam.mff.cuni.cz>

On Thu, Jun 01, 2017 at 01:35:56PM +0200, Jan Hubicka wrote:

Just some very minor nits.

> Index: final.c
> ===================================================================
> --- final.c	(revision 248684)
> +++ final.c	(working copy)
> @@ -1951,9 +1951,11 @@ dump_basic_block_info (FILE *file, rtx_i
>        fprintf (file, "%s BLOCK %d", ASM_COMMENT_START, bb->index);
>        if (bb->frequency)
>          fprintf (file, " freq:%d", bb->frequency);
> -      if (bb->count)
> -        fprintf (file, " count:%" PRId64,
> -                 bb->count);
> +      if (bb->count.initialized_p ())
> +	{
> +          fprintf (file, " count");

Missing colon.
s/count"/count:"/

> Index: profile-count.h
> ===================================================================
> --- profile-count.h	(revision 0)
> +++ profile-count.h	(working copy)

> +/* Main data type to hold profile counters in GCC.  In most cases profile
> +   counts originate from profile feedback. They are 64bit integers
> +   representing number of executions during the train run.
> +   As the profile is maintained during the compilation, many adjustments are
> +   made.  Not all transformations can be made precisely, most importantly
> +   when code is being duplicated.  It also may happen that part of CFG has
> +   profile counts known while other does not - for example when LTO optimizing

s/does not/do not/;# i think

> +   partly profiled program or when profile was lost due to COMDAT merging.
> +
> +   For this information profile_count trakcs more information than

tracks

> +class GTY(()) profile_count
> +{

> +  /* Value of counters which has not been intiailized. Either becuase

initialized
because

> +     initializatoin did not happen yet or because profile is unknown.  */

initialization

> +  static profile_count uninitialized ()
> +    {
> +      profile_count c;
> +      c.m_val = -1;
> +      return c;
> +    }
> +
> +  /* The profiling runtime uses gcov_type, which is usually 64bit integer.
> +     Conversins back and forth are used to read the coverage and get it

Conversions

> +  profile_count &operator+= (const profile_count &other)

I think i saw a_count = a_count + something above and assumed you didn't
have a += operator. Could thus use the terse form in the snipped code
above on the patch, maybe?

> +  /* Return *this * num / den.  */

Parameter names in comment in caps please.

> Index: tree-tailcall.c
> ===================================================================
> --- tree-tailcall.c	(revision 248684)
> +++ tree-tailcall.c	(working copy)
> @@ -767,12 +767,10 @@ adjust_return_value (basic_block bb, tre
>  /* Subtract COUNT and FREQUENCY from the basic block and it's
>     outgoing edge.  */
>  static void
> -decrease_profile (basic_block bb, gcov_type count, int frequency)
> +decrease_profile (basic_block bb, profile_count count, int frequency)
>  {
>    edge e;
> -  bb->count -= count;
> -  if (bb->count < 0)
> -    bb->count = 0;
> +  bb->count = bb->count - count;

That's one of the spots where i'd have expected use of operator -=, fwiw.

> Index: value-prof.c
> ===================================================================
> --- value-prof.c	(revision 248684)
> +++ value-prof.c	(working copy)
> @@ -588,8 +588,10 @@ free_histograms (struct function *fn)
>  
>  static bool
>  check_counter (gimple *stmt, const char * name,
> -	       gcov_type *count, gcov_type *all, gcov_type bb_count)
> +	       gcov_type *count, gcov_type *all, profile_count bb_count_d)
>  {
> +  gcov_type bb_count = bb_count_d.to_gcov_type ();
> +  return true;

On purpose?

thanks,

  reply	other threads:[~2017-06-03 18:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 11:36 Jan Hubicka
2017-06-03 18:51 ` Bernhard Reutner-Fischer [this message]
2017-06-04 17:21   ` Jan Hubicka
2017-06-05 15:13     ` Joseph Myers
2017-06-05 15:16       ` Jan Hubicka
2017-06-05 15:37       ` Jan Hubicka
2017-06-05 18:38         ` Andrew Pinski
2017-06-06  5:57 ` Jason Merrill
2017-06-06  8:00   ` Jan Hubicka
2017-06-08 16:57     ` Jason Merrill
2017-06-09  7:52       ` Jan Hubicka
2017-06-06 16:31 ` Segher Boessenkool
2017-06-06 20:25   ` Jan Hubicka
2017-06-07 18:44     ` Segher Boessenkool
2017-06-07 21:11       ` Jan Hubicka
2017-06-07 21:41         ` Segher Boessenkool
2017-06-05 18:52 Dominique d'Humières
2017-06-05 19:14 ` Jan Hubicka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170603185121.256e75kqlwhvegdd@nbbrfq.cc.univie.ac.at \
    --to=rep.dot.nop@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).