Commit 1bbb87c4 by Jan Hubicka Committed by Jan Hubicka

re PR bootstrap/60984 (AIX: gcc-4.9.0 bootstrap fails in stage-2)


	PR bootstrap/60984
	* ipa-inline-transform.c (inline_call): Use add CALLEE_REMOVED parameter.
	* ipa-inline.c (inline_to_all_callers): If callee was removed; return.
	(ipa_inline): Loop inline_to_all_callers until no more aliases are removed.

From-SVN: r210674
parent d5ce4663
2014-05-20 Jan Hubicka <hubicka@ucw.cz> 2014-05-20 Jan Hubicka <hubicka@ucw.cz>
PR bootstrap/60984
* ipa-inline-transform.c (inline_call): Use add CALLEE_REMOVED parameter.
* ipa-inline.c (inline_to_all_callers): If callee was removed; return.
(ipa_inline): Loop inline_to_all_callers until no more aliases are removed.
2014-05-20 Jan Hubicka <hubicka@ucw.cz>
* ipa.c (ipa_discover_readonly_nonaddressable_var): Fix dumping; * ipa.c (ipa_discover_readonly_nonaddressable_var): Fix dumping;
set writeonly flag only for vars actually written to. set writeonly flag only for vars actually written to.
......
...@@ -215,6 +215,7 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, ...@@ -215,6 +215,7 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
it is NULL. If UPDATE_OVERALL_SUMMARY is false, do not bother to recompute overall 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 size of caller after inlining. Caller is required to eventually do it via
inline_update_overall_summary. 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 Return true iff any new callgraph edges were discovered as a
result of inlining. */ result of inlining. */
...@@ -222,7 +223,8 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, ...@@ -222,7 +223,8 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
bool bool
inline_call (struct cgraph_edge *e, bool update_original, inline_call (struct cgraph_edge *e, bool update_original,
vec<cgraph_edge_p> *new_edges, vec<cgraph_edge_p> *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; int old_size = 0, new_size = 0;
struct cgraph_node *to = NULL; struct cgraph_node *to = NULL;
...@@ -261,6 +263,8 @@ inline_call (struct cgraph_edge *e, bool update_original, ...@@ -261,6 +263,8 @@ inline_call (struct cgraph_edge *e, bool update_original,
{ {
next_alias = cgraph_alias_target (alias); next_alias = cgraph_alias_target (alias);
cgraph_remove_node (alias); cgraph_remove_node (alias);
if (callee_removed)
*callee_removed = true;
alias = next_alias; alias = next_alias;
} }
else else
......
...@@ -1971,6 +1971,8 @@ static bool ...@@ -1971,6 +1971,8 @@ static bool
inline_to_all_callers (struct cgraph_node *node, void *data) inline_to_all_callers (struct cgraph_node *node, void *data)
{ {
int *num_calls = (int *)data; int *num_calls = (int *)data;
bool callee_removed = false;
while (node->callers && !node->global.inlined_to) while (node->callers && !node->global.inlined_to)
{ {
struct cgraph_node *caller = node->callers->caller; struct cgraph_node *caller = node->callers->caller;
...@@ -1987,7 +1989,7 @@ inline_to_all_callers (struct cgraph_node *node, void *data) ...@@ -1987,7 +1989,7 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
inline_summary (node->callers->caller)->size); 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) if (dump_file)
fprintf (dump_file, fprintf (dump_file,
" Inlined into %s which now has %i size\n", " Inlined into %s which now has %i size\n",
...@@ -1997,8 +1999,10 @@ inline_to_all_callers (struct cgraph_node *node, void *data) ...@@ -1997,8 +1999,10 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
{ {
if (dump_file) if (dump_file)
fprintf (dump_file, "New calls found; giving up.\n"); fprintf (dump_file, "New calls found; giving up.\n");
return true; return callee_removed;
} }
if (callee_removed)
return true;
} }
return false; return false;
} }
...@@ -2244,8 +2248,9 @@ ipa_inline (void) ...@@ -2244,8 +2248,9 @@ ipa_inline (void)
int num_calls = 0; int num_calls = 0;
cgraph_for_node_and_aliases (node, sum_callers, cgraph_for_node_and_aliases (node, sum_callers,
&num_calls, true); &num_calls, true);
cgraph_for_node_and_aliases (node, inline_to_all_callers, while (cgraph_for_node_and_aliases (node, inline_to_all_callers,
&num_calls, true); &num_calls, true))
;
remove_functions = true; remove_functions = true;
} }
} }
......
...@@ -236,7 +236,8 @@ void compute_inline_parameters (struct cgraph_node *, bool); ...@@ -236,7 +236,8 @@ void compute_inline_parameters (struct cgraph_node *, bool);
bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining); bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining);
/* In ipa-inline-transform.c */ /* In ipa-inline-transform.c */
bool inline_call (struct cgraph_edge *, bool, vec<cgraph_edge_p> *, int *, bool); bool inline_call (struct cgraph_edge *, bool, vec<cgraph_edge_p> *, int *, bool,
bool *callee_removed = NULL);
unsigned int inline_transform (struct cgraph_node *); unsigned int inline_transform (struct cgraph_node *);
void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *, void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *,
int freq_scale); int freq_scale);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment