public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bin.Cheng" <amker.cheng@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: bin.cheng@linux.alibaba.com,
	gcc-patches List <gcc-patches@gcc.gnu.org>,
		Richard Guenther <richard.guenther@gmail.com>
Subject: Re: [PATCH AutoFDO/2]Treat ZERO as common profile probability/count
Date: Tue, 13 Nov 2018 06:58:00 -0000	[thread overview]
Message-ID: <CAHFci29tu1Ymf0ufTrJAHx71PQBoAyJG5_EcCqrMSU9TR2vQOg@mail.gmail.com> (raw)
In-Reply-To: <20181105144014.mks64anywpivjdxg@kam.mff.cuni.cz>

On Mon, Nov 5, 2018 at 10:40 PM Jan Hubicka <hubicka@ucw.cz> wrote:
>
> diff --git a/gcc/profile-count.h b/gcc/profile-count.h
> index 4289bc5a004..2b5e3269250 100644
> --- a/gcc/profile-count.h
> +++ b/gcc/profile-count.h
> @@ -218,6 +218,11 @@ public:
>      }
>
>
> +  /* Return true if value is zero.  */
> +  bool never_p () const
> +    {
> +      return m_val == 0;
> +    }
>    /* Return true if value has been initialized.  */
>    bool initialized_p () const
>      {
> @@ -288,9 +293,9 @@ public:
>      }
>    profile_probability operator+ (const profile_probability &other) const
>      {
> -      if (other == profile_probability::never ())
> +      if (other.never_p ())
>         return *this;
> -      if (*this == profile_probability::never ())
> +      if (this->never_p ())
>
> This is not correct change.  If you add guessed 0 to precise 0,
> the result needs to be guessed 0 because we are no longer sure the code
> will not get executed.  This is why all the checks here go explicitly
> to profile_probability::never.
Hmm, so precise 0 means the code can never get executed? I also noticed
that in predict.c there are lots of direct assignment of profile_count::zero as:
propagation_unlikely_bbs_forward (void)
{
  //...
  bb->count = profile_count::zero ();
  //...
}
This generally promote profile_count::zero from lower precision to precise
precision, but function name/comment seems targeting unlikely executed
code, rather than never executed.  Is this inconsistent?

Thanks,
bin

>
> Honza

  reply	other threads:[~2018-11-13  6:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31  8:33 bin.cheng
2018-10-31  9:43 ` Richard Biener
2018-10-31  9:57   ` Bin.Cheng
2018-11-02  5:31   ` bin.cheng
2018-11-05 14:38     ` Jan Hubicka
2018-11-05 14:40     ` Jan Hubicka
2018-11-13  6:58       ` Bin.Cheng [this message]
     [not found]   ` <20181105141206.4ncu3s2v2jxv6o54@kam.mff.cuni.cz>
2018-11-20 10:54     ` bin.cheng
     [not found]       ` <CAHFci28CQB3KK+Yp7gb8BR61UaGhAJJ-R1yzZPHxitczvgEB3w@mail.gmail.com>
2018-11-28 16:20         ` Jan Hubicka
2018-12-04  8:40           ` Bin.Cheng
2018-12-07 10:00             ` Bin.Cheng
2018-12-07 16:57               ` Jan Hubicka
2018-12-09  6:40                 ` Bin.Cheng
2018-10-31 15:02 ` Jeff Law
2018-11-01  1:11   ` Bin.Cheng

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=CAHFci29tu1Ymf0ufTrJAHx71PQBoAyJG5_EcCqrMSU9TR2vQOg@mail.gmail.com \
    --to=amker.cheng@gmail.com \
    --cc=bin.cheng@linux.alibaba.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=richard.guenther@gmail.com \
    /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).