http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55797
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-08 14:24:59 UTC --- Solution to put off recursive inlining through iteration: Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 195014) +++ ipa-inline.c (working copy) @@ -1951,7 +1951,9 @@ early_inline_small_functions (struct cgr if (!can_early_inline_edge_p (e)) continue; - if (cgraph_edge_recursive_p (e)) + if (cgraph_edge_recursive_p (e) + || !DECL_STRUCT_FUNCTION + (callee->symbol.decl)->always_inline_functions_inlined) { if (dump_file) fprintf (dump_file, " Not inlining: recursive call.\n"); as we process functions in DFS order any not already processed function is in a callgraph cycle. This doesn't fix the overzealeous inlining via the iteration for the testcase though as we still grow in calls quadratically (we never hit a direct recursive call when inlining the recursive sub-callgraph). That is, early inlining completely misses the graph topology hints (never inline a SCC entry edge, etc.)