From 517048cef0edf7ec35d7091ef4fea232edd48a53 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 18 Nov 2017 23:55:56 +0100 Subject: cgraphclones.c (cgraph_edge::clone): Rename gcov_count to prof_count. * cgraphclones.c (cgraph_edge::clone): Rename gcov_count to prof_count. (cgraph_edge::clone): Cleanup updating of profile. * ipa-cp.c (update_profiling_info): Likewise. * ipa-inline-transform.c (inline_transform): Likewise. * ipa-inline.c (inline_small_functions): Add missing space to dump. * ipa-split.c (execute_split_functions): Do not split when function is cold. * predict.c (estimate_bb_frequencies): Cleanup updating of profile. * profile-count.c (profile_count::dump): Add global0. (profile_count::to_cgraph_frequency): Do not ICE when entry is undefined. (profile_count::to_sreal_scale): Likewise. (profile_count::adjust_for_ipa_scaling): Fix typo in comment. (profile_count::combine_with_ipa_count): New function. * profile-count.h (profile_guessed_global0adjusted): New. (profile_count::adjusted_zero): New. (profile_count::global0adjusted): New. (profile_count::combine_with_ipa_count): New. * tree-inline.c (copy_edges_for_bb): Add NUM/DEN arugment; correct profile of return block of split functions. (copy_cfg_body): Remove unused profile_count. (copy_body): Likewise. (expand_call_inline): Update. (tree_function_versioning): Update. From-SVN: r254919 --- gcc/profile-count.h | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'gcc/profile-count.h') diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 66a217d..2ffa33f 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -36,22 +36,24 @@ enum profile_quality { Never used by probabilities. */ profile_guessed_global0 = 1, + /* Same as profile_guessed_global0 but global count is adjusted 0. */ + profile_guessed_global0adjusted = 2, /* 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 = 2, + profile_guessed = 3, /* Profile was determined by autofdo. */ - profile_afdo = 3, + profile_afdo = 4, /* 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 = 4, + profile_adjusted = 5, /* Profile was read from profile feedback or determined by accurate static method. */ - profile_precise = 5 + profile_precise = 7 }; /* The base value for branch probability notes and edge probabilities. */ @@ -637,6 +639,13 @@ public: { return from_gcov_type (0); } + static profile_count adjusted_zero () + { + profile_count c; + c.m_val = 0; + c.m_quality = profile_adjusted; + return c; + } static profile_count guessed_zero () { profile_count c; @@ -978,7 +987,7 @@ public: return ret; } - /* We know that profile is globally0 but keep local profile if present. */ + /* We know that profile is globally 0 but keep local profile if present. */ profile_count global0 () const { profile_count ret = *this; @@ -988,6 +997,17 @@ public: return ret; } + /* We know that profile is globally adjusted 0 but keep local profile + if present. */ + profile_count global0adjusted () const + { + profile_count ret = *this; + if (!initialized_p ()) + return *this; + ret.m_quality = profile_guessed_global0adjusted; + return ret; + } + /* Return THIS with quality dropped to GUESSED. */ profile_count guessed () const { @@ -1000,10 +1020,12 @@ public: acorss functions. */ profile_count ipa () const { - if (m_quality > profile_guessed_global0) + if (m_quality > profile_guessed_global0adjusted) return *this; if (m_quality == profile_guessed_global0) return profile_count::zero (); + if (m_quality == profile_guessed_global0adjusted) + return profile_count::adjusted_zero (); return profile_count::uninitialized (); } @@ -1054,6 +1076,13 @@ public: kinds. */ static void adjust_for_ipa_scaling (profile_count *num, profile_count *den); + /* THIS is a count of bb which is known to be executed IPA times. + Combine this information into bb counter. This means returning IPA + if it is nonzero, not changing anything if IPA is uninitialized + and if IPA is zero, turning THIS into corresponding local profile with + global0. */ + profile_count combine_with_ipa_count (profile_count ipa); + /* LTO streaming support. */ static profile_count stream_in (struct lto_input_block *); void stream_out (struct output_block *); -- cgit v1.1