diff options
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 (); +} |