From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9760 invoked by alias); 20 May 2014 22:48:49 -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 9269 invoked by uid 55); 20 May 2014 22:48:43 -0000 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/60984] [4.9 Regression] AIX: gcc-4.9.0 bootstrap fails in stage-2 Date: Tue, 20 May 2014 22:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Version: 4.9.1 X-Bugzilla-Keywords: build, ice-on-valid-code X-Bugzilla-Severity: blocker X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: hubicka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.1 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: 2014-05/txt/msg01784.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60984 --- Comment #24 from Jan Hubicka --- Hi, the problem turns out to be quite ugly issue where inline_call removes dead alias, but the alias is being walked by cgraph_for_node_and_aliases used by ipa-inline to inline function into all callees. The attached patch (I am still testing) makes us to restart the walk in this case. Honza Index: ipa-inline-transform.c =================================================================== --- ipa-inline-transform.c (revision 210624) +++ ipa-inline-transform.c (working copy) @@ -214,6 +214,7 @@ it is NULL. If UPDATE_OVERALL_SUMMARY is false, do not bother to recompute overall size of caller after inlining. Caller is required to eventually do it via inline_update_overall_summary. + If callee_removed is non-NULL, set it to true if we removed callee node. Return true iff any new callgraph edges were discovered as a result of inlining. */ @@ -221,7 +222,8 @@ bool inline_call (struct cgraph_edge *e, bool update_original, vec *new_edges, - int *overall_size, bool update_overall_summary) + int *overall_size, bool update_overall_summary, + bool *callee_removed) { int old_size = 0, new_size = 0; struct cgraph_node *to = NULL; @@ -260,6 +262,8 @@ { next_alias = cgraph_alias_target (alias); cgraph_remove_node (alias); + if (callee_removed) + *callee_removed = true; alias = next_alias; } else Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 210624) +++ ipa-inline.c (working copy) @@ -1971,6 +1971,8 @@ inline_to_all_callers (struct cgraph_node *node, void *data) { int *num_calls = (int *)data; + bool callee_removed = false; + while (node->callers && !node->global.inlined_to) { struct cgraph_node *caller = node->callers->caller; @@ -1987,7 +1989,7 @@ inline_summary (node->callers->caller)->size); } - inline_call (node->callers, true, NULL, NULL, true); + inline_call (node->callers, true, NULL, NULL, true, &callee_removed); if (dump_file) fprintf (dump_file, " Inlined into %s which now has %i size\n", @@ -1997,8 +1999,10 @@ { if (dump_file) fprintf (dump_file, "New calls found; giving up.\n"); - return true; + return callee_removed; } + if (callee_removed) + return true; } return false; } @@ -2244,8 +2248,9 @@ int num_calls = 0; cgraph_for_node_and_aliases (node, sum_callers, &num_calls, true); - cgraph_for_node_and_aliases (node, inline_to_all_callers, - &num_calls, true); + while (cgraph_for_node_and_aliases (node, inline_to_all_callers, + &num_calls, true)) + ; remove_functions = true; } } Index: ipa-inline.h =================================================================== --- ipa-inline.h (revision 210624) +++ ipa-inline.h (working copy) @@ -236,7 +236,8 @@ bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining); /* In ipa-inline-transform.c */ -bool inline_call (struct cgraph_edge *, bool, vec *, int *, bool); +bool inline_call (struct cgraph_edge *, bool, vec *, int *, bool, + bool *callee_removed = NULL); unsigned int inline_transform (struct cgraph_node *); void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *, int freq_scale);