This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix accounting of call edges in inliner
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Nov 2017 20:32:29 +0100
- Subject: Fix accounting of call edges in inliner
- Authentication-results: sourceware.org; auth=none
Hi,
this patch makes call time computations consistent again.
Bootstrapped/regtested x86_64-linux, comitted.
Honza
* ipa-inline.c (edge_badness): Dump sreal frequency.
(compute_inlined_call_time): Match natural implementaiton ...
* ipa-fnsummary.c (estimate_edge_size_and_time): ... here; remove
forgotten division by CGRAPH_FREQ_BASE.
Index: ipa-inline.c
===================================================================
--- ipa-inline.c (revision 254724)
+++ ipa-inline.c (working copy)
@@ -670,8 +670,7 @@ compute_inlined_call_time (struct cgraph
/* This calculation should match one in ipa-inline-analysis.c
(estimate_edge_size_and_time). */
- time -= (sreal) edge->frequency ()
- * ipa_call_summaries->get (edge)->call_stmt_time / CGRAPH_FREQ_BASE;
+ time -= (sreal)ipa_call_summaries->get (edge)->call_stmt_time * freq;
time += caller_time;
if (time <= 0)
time = ((sreal) 1) >> 8;
@@ -1164,7 +1163,7 @@ edge_badness (struct cgraph_edge *edge,
" overall growth %i (current) %i (original)"
" %i (compensated)\n",
badness.to_double (),
- (double)edge->frequency () / CGRAPH_FREQ_BASE,
+ edge->sreal_frequency ().to_double (),
edge->count.ipa ().initialized_p () ? edge->count.ipa ().to_gcov_type () : -1,
caller->count.ipa ().initialized_p () ? caller->count.ipa ().to_gcov_type () : -1,
compute_uninlined_call_time (edge,
Index: ipa-fnsummary.c
===================================================================
--- ipa-fnsummary.c (revision 254719)
+++ ipa-fnsummary.c (working copy)
@@ -2581,8 +2581,7 @@ estimate_edge_size_and_time (struct cgra
if (prob == REG_BR_PROB_BASE)
*time += ((sreal)call_time) * e->sreal_frequency ();
else
- *time += ((sreal)call_time * prob) * e->sreal_frequency ()
- / CGRAPH_FREQ_BASE;
+ *time += ((sreal)call_time * prob) * e->sreal_frequency ();
}