diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2017-11-18 23:55:56 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2017-11-18 22:55:56 +0000 |
commit | 517048cef0edf7ec35d7091ef4fea232edd48a53 (patch) | |
tree | 87fb8324893c35156edda2a67cd930e5e58da277 /gcc/profile-count.c | |
parent | 2563a16d3c7a56cd1e0cfe9b4ccb702edfb12312 (diff) | |
download | gcc-517048cef0edf7ec35d7091ef4fea232edd48a53.zip gcc-517048cef0edf7ec35d7091ef4fea232edd48a53.tar.gz gcc-517048cef0edf7ec35d7091ef4fea232edd48a53.tar.bz2 |
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
Diffstat (limited to 'gcc/profile-count.c')
-rw-r--r-- | gcc/profile-count.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gcc/profile-count.c b/gcc/profile-count.c index 51c3b74..e5d9fae 100644 --- a/gcc/profile-count.c +++ b/gcc/profile-count.c @@ -47,6 +47,8 @@ profile_count::dump (FILE *f) const fprintf (f, " (estimated locally)"); else if (m_quality == profile_guessed_global0) fprintf (f, " (estimated locally, globally 0)"); + else if (m_quality == profile_guessed_global0adjusted) + fprintf (f, " (estimated locally, globally 0 adjusted)"); else if (m_quality == profile_adjusted) fprintf (f, " (adjusted)"); else if (m_quality == profile_afdo) @@ -245,7 +247,7 @@ profile_count::to_frequency (struct function *fun) const int profile_count::to_cgraph_frequency (profile_count entry_bb_count) const { - if (!initialized_p ()) + if (!initialized_p () || !entry_bb_count.initialized_p ()) return CGRAPH_FREQ_BASE; if (*this == profile_count::zero ()) return 0; @@ -262,7 +264,7 @@ profile_count::to_cgraph_frequency (profile_count entry_bb_count) const sreal profile_count::to_sreal_scale (profile_count in, bool *known) const { - if (!initialized_p ()) + if (!initialized_p () || !in.initialized_p ()) { if (known) *known = false; @@ -272,7 +274,6 @@ profile_count::to_sreal_scale (profile_count in, bool *known) const *known = true; if (*this == profile_count::zero ()) return 0; - gcc_checking_assert (in.initialized_p ()); if (!in.m_val) { @@ -297,7 +298,7 @@ profile_count::adjust_for_ipa_scaling (profile_count *num, /* Scaling is no-op if NUM and DEN are the same. */ if (*num == *den) return; - /* Scaling to zero is always zeor. */ + /* Scaling to zero is always zero. */ if (*num == profile_count::zero ()) return; /* If den is non-zero we are safe. */ @@ -308,3 +309,21 @@ profile_count::adjust_for_ipa_scaling (profile_count *num, *den = den->force_nonzero (); *num = num->force_nonzero (); } + +/* 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 +profile_count::combine_with_ipa_count (profile_count ipa) +{ + ipa = ipa.ipa (); + if (ipa.nonzero_p ()) + return ipa; + if (!ipa.initialized_p ()) + return *this; + if (ipa == profile_count::zero ()) + return this->global0 (); + return this->global0adjusted (); +} |