From: Jan Hubicka Date: Mon, 13 Oct 2025 10:13:51 +0000 (+0200) Subject: Remove max_count computation from ipa-inline X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dbb61de21e5576f876c5b8fcde39def7d2b2b13;p=thirdparty%2Fgcc.git Remove max_count computation from ipa-inline Ipa inline computes max_count which used to be applied later to compute badness before it was converted to sreal. Now it is only used in couple of places to see if any IPA profile is presents at all. This patch replaces this by more specific flag has_nonzero_ipa_profile. gcc/ChangeLog: * ipa-inline.cc (max_count): Remove. (has_nonzero_ipa_profile): New. (inline_small_functions): Update. (dump_inline_stats): Update. --- diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc index b71ebbe60fd..1f2287da896 100644 --- a/gcc/ipa-inline.cc +++ b/gcc/ipa-inline.cc @@ -175,7 +175,7 @@ typedef fibonacci_node edge_heap_node_t; /* Statistics we collect about inlining algorithm. */ static int overall_size; -static profile_count max_count; +static bool has_nonzero_ipa_profile; static profile_count spec_rem; /* Return false when inlining edge E would lead to violating @@ -2105,7 +2105,7 @@ inline_small_functions (void) /* Compute overall unit size and other global parameters used by badness metrics. */ - max_count = profile_count::uninitialized (); + has_nonzero_ipa_profile = false; ipa_reduced_postorder (order, true, ignore_edge_p); free (order); @@ -2148,7 +2148,9 @@ inline_small_functions (void) } for (edge = node->callers; edge; edge = edge->next_caller) - max_count = max_count.max (edge->count.ipa ()); + if (edge->count.ipa ().initialized_p () + && edge->count.ipa ().nonzero_p ()) + has_nonzero_ipa_profile = true; } ipa_free_postorder_info (); initialize_growth_caches (); @@ -2221,7 +2223,7 @@ inline_small_functions (void) } gcc_assert (in_lto_p - || !(max_count > 0) + || !has_nonzero_ipa_profile || flag_auto_profile || (profile_info && flag_branch_probabilities)); @@ -2243,7 +2245,7 @@ inline_small_functions (void) This check is affected by scaling roundoff errors when compiling for IPA this we skip it in that case. */ if (flag_checking && !edge->callee->count.ipa_p () - && (!max_count.initialized_p () || !max_count.nonzero_p ())) + && !has_nonzero_ipa_profile) { sreal cached_badness = edge_badness (edge, false); @@ -2762,7 +2764,7 @@ dump_inline_stats (void) else if (e->count.ipa ().initialized_p ()) indirect_cnt += e->count.ipa ().to_gcov_type (); } - if (max_count.initialized_p ()) + if (has_nonzero_ipa_profile) { fprintf (dump_file, "Inlined %" PRId64 " + speculative "