From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99372 invoked by alias); 2 Mar 2015 08:06:18 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 88326 invoked by uid 55); 2 Mar 2015 08:06:14 -0000 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/65130] [5 Regression] ICE with LTO on valid code on x86_64-linux-gnu Date: Mon, 02 Mar 2015 08:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: ktietz at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg00083.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65130 --- Comment #11 from Jan Hubicka --- Hi, the bug is caused by code inlining functions called once. Here is a dead self recursive function that is called once (from itself) and the inliner manages to not punt on the rcurisve call and produce cycle. The following patch ought to fix it. Index: ipa-inline-analysis.c =================================================================== --- ipa-inline-analysis.c (revision 221096) +++ ipa-inline-analysis.c (working copy) @@ -1291,7 +1291,8 @@ inline_summary_t::duplicate (cgraph_node set_hint_predicate (&info->array_index, p); } } - inline_update_overall_summary (dst); + if (!dst->global.inlined_to) + inline_update_overall_summary (dst); } @@ -3924,10 +3925,11 @@ do_estimate_growth_1 (struct cgraph_node continue; } - if (e->caller == d->node - || (e->caller->global.inlined_to - && e->caller->global.inlined_to == d->node)) - d->self_recursive = true; + if (e->recursive_p ()) + { + d->self_recursive = true; + continue; + } d->growth += estimate_edge_growth (e); } return false; Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 221096) +++ ipa-inline.c (working copy) @@ -952,6 +952,8 @@ check_callers (struct cgraph_node *node, return true; if (!can_inline_edge_p (e, true)) return true; + if (e->recursive_p ()) + return true; if (!(*(bool *)has_hot_call) && e->maybe_hot_p ()) *(bool *)has_hot_call = true; } @@ -2094,6 +2096,15 @@ inline_to_all_callers (struct cgraph_nod { struct cgraph_node *caller = node->callers->caller; + if (!can_inline_edge_p (node->callers, true) + || node->callers->recursive_p ()) + { + if (dump_file) + fprintf (dump_file, "Uninlinable call found; giving up.\n"); + *num_calls = 0; + return false; + } + if (dump_file) { fprintf (dump_file,