Commit 1ede94c5 by Jan Hubicka Committed by Jan Hubicka

ipa-visibility.c (function_and_variable_visibility): Only check locality if node…

ipa-visibility.c (function_and_variable_visibility): Only check locality if node is not already local.

	* ipa-visibility.c (function_and_variable_visibility): Only
	check locality if node is not already local.
	* ipa-inline.c (want_inline_function_to_all_callers_p): Use
	call_for_symbol_and_aliases instead of
	call_for_symbol_thunks_and_aliases.
	(ipa_inline): Likewise.
	* cgraph.c (cgraph_node::call_for_symbol_thunks_and_aliases):
	first walk aliases.
	* ipa.c (symbol_table::remove_unreachable_nodes): Use
	call_for_symbol_and_aliases.
	* ipa-profile.c (ipa_propagate_frequency_data): Add function_symbol.
	(ipa_propagate_frequency_1): Use it; use opt_for_fn
	(ipa_propagate_frequency): Update.
	(ipa_profile): Add opt_for_fn gueards.

From-SVN: r220775
parent f05911fb
2015-02-17 Jan Hubicka <hubicka@ucw.cz>
* ipa-visibility.c (function_and_variable_visibility): Only
check locality if node is not already local.
* ipa-inline.c (want_inline_function_to_all_callers_p): Use
call_for_symbol_and_aliases instead of
call_for_symbol_thunks_and_aliases.
(ipa_inline): Likewise.
* cgraph.c (cgraph_node::call_for_symbol_thunks_and_aliases):
first walk aliases.
* ipa.c (symbol_table::remove_unreachable_nodes): Use
call_for_symbol_and_aliases.
* ipa-profile.c (ipa_propagate_frequency_data): Add function_symbol.
(ipa_propagate_frequency_1): Use it; use opt_for_fn
(ipa_propagate_frequency): Update.
(ipa_profile): Add opt_for_fn gueards.
2015-02-17 Oleg Endo <olegendo@gcc.gnu.org> 2015-02-17 Oleg Endo <olegendo@gcc.gnu.org>
* config/sh/sh.opt (mcbranch-force-delay-slot): New option. * config/sh/sh.opt (mcbranch-force-delay-slot): New option.
......
...@@ -2191,6 +2191,16 @@ cgraph_node::call_for_symbol_thunks_and_aliases (bool (*callback) ...@@ -2191,6 +2191,16 @@ cgraph_node::call_for_symbol_thunks_and_aliases (bool (*callback)
if (callback (this, data)) if (callback (this, data))
return true; return true;
FOR_EACH_ALIAS (this, ref)
{
cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
if (include_overwritable
|| alias->get_availability () > AVAIL_INTERPOSABLE)
if (alias->call_for_symbol_thunks_and_aliases (callback, data,
include_overwritable,
exclude_virtual_thunks))
return true;
}
for (e = callers; e; e = e->next_caller) for (e = callers; e; e = e->next_caller)
if (e->caller->thunk.thunk_p if (e->caller->thunk.thunk_p
&& (include_overwritable && (include_overwritable
...@@ -2202,16 +2212,6 @@ cgraph_node::call_for_symbol_thunks_and_aliases (bool (*callback) ...@@ -2202,16 +2212,6 @@ cgraph_node::call_for_symbol_thunks_and_aliases (bool (*callback)
exclude_virtual_thunks)) exclude_virtual_thunks))
return true; return true;
FOR_EACH_ALIAS (this, ref)
{
cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
if (include_overwritable
|| alias->get_availability () > AVAIL_INTERPOSABLE)
if (alias->call_for_symbol_thunks_and_aliases (callback, data,
include_overwritable,
exclude_virtual_thunks))
return true;
}
return false; return false;
} }
......
...@@ -975,14 +975,14 @@ want_inline_function_to_all_callers_p (struct cgraph_node *node, bool cold) ...@@ -975,14 +975,14 @@ want_inline_function_to_all_callers_p (struct cgraph_node *node, bool cold)
if (node->global.inlined_to) if (node->global.inlined_to)
return false; return false;
/* Does it have callers? */ /* Does it have callers? */
if (!node->call_for_symbol_thunks_and_aliases (has_caller_p, NULL, true)) if (!node->call_for_symbol_and_aliases (has_caller_p, NULL, true))
return false; return false;
/* Inlining into all callers would increase size? */ /* Inlining into all callers would increase size? */
if (estimate_growth (node) > 0) if (estimate_growth (node) > 0)
return false; return false;
/* All inlines must be possible. */ /* All inlines must be possible. */
if (node->call_for_symbol_thunks_and_aliases (check_callers, &has_hot_call, if (node->call_for_symbol_and_aliases (check_callers, &has_hot_call,
true)) true))
return false; return false;
if (!cold && !has_hot_call) if (!cold && !has_hot_call)
return false; return false;
...@@ -2359,9 +2359,9 @@ ipa_inline (void) ...@@ -2359,9 +2359,9 @@ ipa_inline (void)
if (want_inline_function_to_all_callers_p (node, cold)) if (want_inline_function_to_all_callers_p (node, cold))
{ {
int num_calls = 0; int num_calls = 0;
node->call_for_symbol_thunks_and_aliases (sum_callers, &num_calls, node->call_for_symbol_and_aliases (sum_callers, &num_calls,
true); true);
while (node->call_for_symbol_thunks_and_aliases while (node->call_for_symbol_and_aliases
(inline_to_all_callers, &num_calls, true)) (inline_to_all_callers, &num_calls, true))
; ;
remove_functions = true; remove_functions = true;
......
...@@ -322,6 +322,7 @@ ipa_profile_read_summary (void) ...@@ -322,6 +322,7 @@ ipa_profile_read_summary (void)
struct ipa_propagate_frequency_data struct ipa_propagate_frequency_data
{ {
cgraph_node *function_symbol;
bool maybe_unlikely_executed; bool maybe_unlikely_executed;
bool maybe_executed_once; bool maybe_executed_once;
bool only_called_at_startup; bool only_called_at_startup;
...@@ -342,7 +343,7 @@ ipa_propagate_frequency_1 (struct cgraph_node *node, void *data) ...@@ -342,7 +343,7 @@ ipa_propagate_frequency_1 (struct cgraph_node *node, void *data)
|| d->only_called_at_startup || d->only_called_at_exit); || d->only_called_at_startup || d->only_called_at_exit);
edge = edge->next_caller) edge = edge->next_caller)
{ {
if (edge->caller != node) if (edge->caller != d->function_symbol)
{ {
d->only_called_at_startup &= edge->caller->only_called_at_startup; d->only_called_at_startup &= edge->caller->only_called_at_startup;
/* It makes sense to put main() together with the static constructors. /* It makes sense to put main() together with the static constructors.
...@@ -358,7 +359,11 @@ ipa_propagate_frequency_1 (struct cgraph_node *node, void *data) ...@@ -358,7 +359,11 @@ ipa_propagate_frequency_1 (struct cgraph_node *node, void *data)
errors can make us to push function into unlikely section even when errors can make us to push function into unlikely section even when
it is executed by the train run. Transfer the function only if all it is executed by the train run. Transfer the function only if all
callers are unlikely executed. */ callers are unlikely executed. */
if (profile_info && flag_branch_probabilities if (profile_info
&& opt_for_fn (d->function_symbol->decl, flag_branch_probabilities)
/* Thunks are not profiled. This is more or less implementation
bug. */
&& !d->function_symbol->thunk.thunk_p
&& (edge->caller->frequency != NODE_FREQUENCY_UNLIKELY_EXECUTED && (edge->caller->frequency != NODE_FREQUENCY_UNLIKELY_EXECUTED
|| (edge->caller->global.inlined_to || (edge->caller->global.inlined_to
&& edge->caller->global.inlined_to->frequency && edge->caller->global.inlined_to->frequency
...@@ -418,7 +423,7 @@ contains_hot_call_p (struct cgraph_node *node) ...@@ -418,7 +423,7 @@ contains_hot_call_p (struct cgraph_node *node)
bool bool
ipa_propagate_frequency (struct cgraph_node *node) ipa_propagate_frequency (struct cgraph_node *node)
{ {
struct ipa_propagate_frequency_data d = {true, true, true, true}; struct ipa_propagate_frequency_data d = {node, true, true, true, true};
bool changed = false; bool changed = false;
/* We can not propagate anything useful about externally visible functions /* We can not propagate anything useful about externally visible functions
...@@ -432,8 +437,8 @@ ipa_propagate_frequency (struct cgraph_node *node) ...@@ -432,8 +437,8 @@ ipa_propagate_frequency (struct cgraph_node *node)
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Processing frequency %s\n", node->name ()); fprintf (dump_file, "Processing frequency %s\n", node->name ());
node->call_for_symbol_thunks_and_aliases (ipa_propagate_frequency_1, &d, node->call_for_symbol_and_aliases (ipa_propagate_frequency_1, &d,
true); true);
if ((d.only_called_at_startup && !d.only_called_at_exit) if ((d.only_called_at_startup && !d.only_called_at_exit)
&& !node->only_called_at_startup) && !node->only_called_at_startup)
...@@ -597,6 +602,9 @@ ipa_profile (void) ...@@ -597,6 +602,9 @@ ipa_profile (void)
{ {
bool update = false; bool update = false;
if (!opt_for_fn (n->decl, flag_ipa_profile))
continue;
for (e = n->indirect_calls; e; e = e->next_callee) for (e = n->indirect_calls; e; e = e->next_callee)
{ {
if (n->count) if (n->count)
...@@ -697,7 +705,9 @@ ipa_profile (void) ...@@ -697,7 +705,9 @@ ipa_profile (void)
order_pos = ipa_reverse_postorder (order); order_pos = ipa_reverse_postorder (order);
for (i = order_pos - 1; i >= 0; i--) for (i = order_pos - 1; i >= 0; i--)
{ {
if (order[i]->local.local && ipa_propagate_frequency (order[i])) if (order[i]->local.local
&& opt_for_fn (order[i]->decl, flag_ipa_profile)
&& ipa_propagate_frequency (order[i]))
{ {
for (e = order[i]->callees; e; e = e->next_callee) for (e = order[i]->callees; e; e = e->next_callee)
if (e->callee->local.local && !e->callee->aux) if (e->callee->local.local && !e->callee->aux)
...@@ -714,7 +724,9 @@ ipa_profile (void) ...@@ -714,7 +724,9 @@ ipa_profile (void)
something_changed = false; something_changed = false;
for (i = order_pos - 1; i >= 0; i--) for (i = order_pos - 1; i >= 0; i--)
{ {
if (order[i]->aux && ipa_propagate_frequency (order[i])) if (order[i]->aux
&& opt_for_fn (order[i]->decl, flag_ipa_profile)
&& ipa_propagate_frequency (order[i]))
{ {
for (e = order[i]->callees; e; e = e->next_callee) for (e = order[i]->callees; e; e = e->next_callee)
if (e->callee->local.local && !e->callee->aux) if (e->callee->local.local && !e->callee->aux)
......
...@@ -661,7 +661,7 @@ symbol_table::remove_unreachable_nodes (FILE *file) ...@@ -661,7 +661,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
if (node->address_taken if (node->address_taken
&& !node->used_from_other_partition) && !node->used_from_other_partition)
{ {
if (!node->call_for_symbol_thunks_and_aliases if (!node->call_for_symbol_and_aliases
(has_addr_references_p, NULL, true) (has_addr_references_p, NULL, true)
&& (!node->instrumentation_clone && (!node->instrumentation_clone
|| !node->instrumented_version || !node->instrumented_version
......
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