------- Comment #23 from rguenth at gcc dot gnu dot org 2006-07-19 13:31 ------- I have a patch:
Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 115554) +++ ipa-inline.c (working copy) @@ -1133,6 +1133,7 @@ cgraph_early_inlining (void) struct cgraph_node **order = xcalloc (cgraph_n_nodes, sizeof (struct cgraph_node *)); int i; + htab_t cycles; if (sorrycount || errorcount) return; @@ -1142,6 +1143,8 @@ cgraph_early_inlining (void) #endif nnodes = cgraph_postorder (order); + cycles = htab_create (7, htab_hash_pointer, htab_eq_pointer, NULL); + cgraph_find_cycles (cgraph_nodes, cycles); for (i = nnodes - 1; i >= 0; i--) { node = order[i]; @@ -1149,10 +1152,13 @@ cgraph_early_inlining (void) && (node->needed || node->reachable) && node->callers) { - if (cgraph_decide_inlining_incrementally (node, true)) + if (cgraph_decide_inlining_incrementally (node, true) + /* Avoid collecting if inlining in a cycle. */ + && !htab_find (cycles, node)) ggc_collect (); } } + htab_delete (cycles); cgraph_remove_unreachable_nodes (true, dump_file); #ifdef ENABLE_CHECKING for (node = cgraph_nodes; node; node = node->next) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27882