diff options
author | Martin Liska <mliska@suse.cz> | 2018-01-23 13:24:55 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-01-23 12:24:55 +0000 |
commit | 175946876361bd3ac360361e67d12761974a479e (patch) | |
tree | 912046844c2e3140f6472ef118a01bc31e65bdb7 | |
parent | d55d1e4fa9fbab3e47b91391c6a3986ca9f6f1ff (diff) | |
download | gcc-175946876361bd3ac360361e67d12761974a479e.zip gcc-175946876361bd3ac360361e67d12761974a479e.tar.gz gcc-175946876361bd3ac360361e67d12761974a479e.tar.bz2 |
Fix profile_quality sanity check.
2018-01-22 Martin Liska <mliska@suse.cz>
* profile-count.h (enum profile_quality): Add
profile_uninitialized as the first value. Do not number values
as they are zero based.
(profile_count::verify): Update sanity check.
(profile_probability::verify): Likewise.
From-SVN: r256982
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/profile-count.h | 22 |
2 files changed, 19 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9cda294..19b2137 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-01-23 Martin Liska <mliska@suse.cz> + + * profile-count.h (enum profile_quality): Add + profile_uninitialized as the first value. Do not number values + as they are zero based. + (profile_count::verify): Update sanity check. + (profile_probability::verify): Likewise. + 2018-01-23 Nathan Sidwell <nathan@acm.org> * doc/invoke.texi (ffor-scope): Deprecate. diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 69919ee..234e388 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -26,34 +26,36 @@ struct function; /* Quality of the profile count. Because gengtype does not support enums inside of classes, this is in global namespace. */ enum profile_quality { + /* Uninitialized value. */ + profile_uninitialized, /* Profile is based on static branch prediction heuristics and may or may not match reality. It is local to function and can not be compared inter-procedurally. Never used by probabilities (they are always local). */ - profile_guessed_local = 1, + profile_guessed_local, /* Profile was read by feedback and was 0, we used local heuristics to guess better. This is the case of functions not run in profile fedback. Never used by probabilities. */ - profile_guessed_global0 = 2, + profile_guessed_global0, /* Same as profile_guessed_global0 but global count is adjusted 0. */ - profile_guessed_global0adjusted = 3, + profile_guessed_global0adjusted, /* Profile is based on static branch prediction heuristics. It may or may not reflect the reality but it can be compared interprocedurally (for example, we inlined function w/o profile feedback into function with feedback and propagated from that). Never used by probablities. */ - profile_guessed = 4, + profile_guessed, /* Profile was determined by autofdo. */ - profile_afdo = 5, + profile_afdo, /* Profile was originally based on feedback but it was adjusted by code duplicating optimization. It may not precisely reflect the particular code path. */ - profile_adjusted = 6, + profile_adjusted, /* Profile was read from profile feedback or determined by accurate static method. */ - profile_precise = 7 + profile_precise }; /* The base value for branch probability notes and edge probabilities. */ @@ -529,8 +531,7 @@ public: /* Return false if profile_probability is bogus. */ bool verify () const { - gcc_checking_assert (profile_guessed_local <= m_quality - && m_quality <= profile_precise); + gcc_checking_assert (m_quality != profile_uninitialized); if (m_val == uninitialized_probability) return m_quality == profile_guessed; else if (m_quality < profile_guessed) @@ -815,8 +816,7 @@ public: /* Return false if profile_count is bogus. */ bool verify () const { - gcc_checking_assert (profile_guessed_local <= m_quality - && m_quality <= profile_precise); + gcc_checking_assert (m_quality != profile_uninitialized); return m_val != uninitialized_count || m_quality == profile_guessed_local; } |