Hi, this patch fixes quite embarasing and aged bug that do_estimate_edge_time does not return correct nonspec_time first time it is executed (when value is not in cache). This does not really have effect on generated code because inliner computes the value twice but it does increase fibonaci heap overhead because priorities are calculated wrong first time around.
Bootstrapped/regtested x86_64-linux, comitted. Honza * ipa-inline.h (do_estimate_edge_time): Add nonspec_time parameter. (estimate_edge_time): Use it. * ipa-inine-analysis.c (do_estimate_edge_time): Add ret_nonspec_time parameter. Index: ipa-inline.h =================================================================== --- ipa-inline.h (revision 278306) +++ ipa-inline.h (working copy) @@ -46,7 +46,7 @@ int estimate_size_after_inlining (struct int estimate_growth (struct cgraph_node *); bool growth_positive_p (struct cgraph_node *, struct cgraph_edge *, int); int do_estimate_edge_size (struct cgraph_edge *edge); -sreal do_estimate_edge_time (struct cgraph_edge *edge); +sreal do_estimate_edge_time (struct cgraph_edge *edge, sreal *nonspec_time = NULL); ipa_hints do_estimate_edge_hints (struct cgraph_edge *edge); void reset_node_cache (struct cgraph_node *node); void initialize_growth_caches (); @@ -99,7 +99,7 @@ estimate_edge_time (struct cgraph_edge * if (edge_growth_cache == NULL || (entry = edge_growth_cache->get (edge)) == NULL || entry->time == 0) - return do_estimate_edge_time (edge); + return do_estimate_edge_time (edge, nonspec_time); if (nonspec_time) *nonspec_time = edge_growth_cache->get (edge)->nonspec_time; return entry->time; Index: ipa-inline-analysis.c =================================================================== --- ipa-inline-analysis.c (revision 278306) +++ ipa-inline-analysis.c (working copy) @@ -179,7 +179,7 @@ simple_edge_hints (struct cgraph_edge *e size, since we always need both metrics eventually. */ sreal -do_estimate_edge_time (struct cgraph_edge *edge) +do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time) { sreal time, nonspec_time; int size; @@ -275,6 +275,8 @@ do_estimate_edge_time (struct cgraph_edg hints |= simple_edge_hints (edge); entry->hints = hints + 1; } + if (ret_nonspec_time) + *ret_nonspec_time = nonspec_time; return time; }