On Mon, Nov 5, 2018 at 10:40 PM Jan Hubicka <hubi...@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 via email to