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. Honza