diff --git a/gcc/profile-count.h b/gcc/profile-count.h index f4d0c340a0a..4289bc5a004 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -200,11 +200,11 @@ public: ret.m_quality = profile_guessed; return ret; } - static profile_probability always () + static profile_probability always (enum profile_quality q = profile_precise)
There are functions to convert value into given precision. If you wnat to guess that something is always taken, you write profile_probability::always().guessed () So for autofdo we only need to add .atofdo() conversion method. @@ -459,10 +459,12 @@ public: return RDIV (val * m_val, max_probability); } - /* Return 1-*THIS. */ + /* Return 1-*THIS. It's meaningless to invert an uninitialized value. */ profile_probability invert () const { - return profile_probability::always() - *this; + if (! initialized_p ()) + return *this; + return profile_probability::always (m_quality) - *this; How this changes the behaviour? If THIS is uninitialied profile_probability::alwyas() will return uninitialized which seem to make sense. If you have value of some quality it will merge the qualitis and will return value in corresponding m_quality.