http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60315
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- When calling do_estimate_edge_size to compute the effect on caller size when inlining an edge we call estimate_node_size_and_time which eventually recurses down to estimate_calls_size_and_time (why!? call edges in the callee are irrelevant when inlining the call into the caller!). Doesn't this just want to add(?) e->call_stmt_size/time? At the moment estimate_calls_size_and_time recurses to estimate_edge_size_and_time ... and I don't see _any_ prevention of running in cgraph cycles here. (and the cache isn't populated before computing an edges size/time is). In fact, Index: gcc/ipa-inline-analysis.c =================================================================== --- gcc/ipa-inline-analysis.c (revision 207960) +++ gcc/ipa-inline-analysis.c (working copy) @@ -3011,21 +3011,11 @@ estimate_calls_size_and_time (struct cgr struct inline_edge_summary *es = inline_edge_summary (e); if (!es->predicate || evaluate_predicate (es->predicate, possible_truths)) - { - if (e->inline_failed) - { - /* Predicates of calls shall not use NOT_CHANGED codes, - sowe do not need to compute probabilities. */ - estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE, - known_vals, known_binfos, - known_aggs, hints); - } - else - estimate_calls_size_and_time (e->callee, size, time, hints, - possible_truths, - known_vals, known_binfos, - known_aggs); - } + /* Predicates of calls shall not use NOT_CHANGED codes, + sowe do not need to compute probabilities. */ + estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE, + known_vals, known_binfos, + known_aggs, hints); } for (e = node->indirect_calls; e; e = e->next_callee) { fixes this and I cannot make sense of calling estimate_calls_size_and_time for the callee of an edge that we are not going to inline (or that is already inlined? I still find those if (e->inline_failed) checks odd). If it's supposed to account for inline bodies in the caller then we should have updated the inline_summary () of the caller, not have to recurse here - and we _do_ seem to (inline_merge_summary).