> > On Wed, Oct 31, 2012 at 3:17 PM, Paolo Carlini <paolo.carl...@oracle.com> > > wrote: > > > Hi, > > > > > > whoever a few days ago or so broke this test, can please either fix the > > > testcase, the compiler or just xfail for now the testcase itself, to avoid > > > everybody the waste of time? > > > > > > If you want me to do go ahead with option 3 above, just let me know! > > > > It was honza - we endlessly recurse in estimate_calls_size_and_time. > > > > Honza, please make fixing this a priority. > > I am looing into it now. Did not noticed that - at -O3 it hits the ipa-cp > issue > I hope Martin will fix. > > The problem here is not infinite recursion, we keep inlning the foo into > itself > since indirect inlining somehow misses the limits on recursion depth and the > function is empty and thus inlining has no cost.
The problem is that with new costs and new code for inlining functions called once we end up inlining empty virutal function to itself hoping to kill it. I am testing the following that makes us to give up in such a werid case. Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 193035) +++ ipa-inline.c (working copy) @@ -1767,29 +1878,41 @@ ipa_inline (void) FOR_EACH_DEFINED_FUNCTION (node) { if (want_inline_function_to_all_callers_p (node, cold)) - while (node->callers && !node->global.inlined_to) - { - struct cgraph_node *caller = node->callers->caller; + { + int num_calls = 0; + struct cgraph_edge *e; + for (e = node->callers; e; e = e->next_caller) + num_calls++; + while (node->callers && !node->global.inlined_to) + { + struct cgraph_node *caller = node->callers->caller; + + if (dump_file) + { + fprintf (dump_file, + "\nInlining %s size %i.\n", + cgraph_node_name (node), + inline_summary (node)->size); + fprintf (dump_file, + " Called once from %s %i insns.\n", + cgraph_node_name (node->callers->caller), + inline_summary (node->callers->caller)->size); + } - if (dump_file) - { + inline_call (node->callers, true, NULL, NULL, true); + if (dump_file) fprintf (dump_file, - "\nInlining %s size %i.\n", - cgraph_node_name (node), - inline_summary (node)->size); - fprintf (dump_file, - " Called once from %s %i insns.\n", - cgraph_node_name (node->callers->caller), - inline_summary (node->callers->caller)->size); - } - - inline_call (node->callers, true, NULL, NULL, true); - if (dump_file) - fprintf (dump_file, - " Inlined into %s which now has %i size\n", - cgraph_node_name (caller), - inline_summary (caller)->size); - } + " Inlined into %s which now has %i size\n", + cgraph_node_name (caller), + inline_summary (caller)->size); + if (!num_calls--) + { + if (dump_file) + fprintf (dump_file, "New calls found; giving up.\n"); + break; + } + } + } } } }