Commit 0eaf0bfe by Jan Hubicka Committed by Jan Hubicka

cgraphunit.c (cgraph_node::finalize_function): When !flag_toplevel_reorde set no_reorder flag.


	* cgraphunit.c (cgraph_node::finalize_function): When
	!flag_toplevel_reorde set no_reorder flag.
	(varpool_node::finalize_decl): Likewise.
	(symbol_table::compile): Drop no toplevel reorder path.

	* lto-partition.c (lto_balanced_map): Do not check
	flag_toplevel_reorder.

From-SVN: r250034
parent b0a12b5e
2017-07-06 Jan Hubicka <hubicka@ucw.cz> 2017-07-06 Jan Hubicka <hubicka@ucw.cz>
* cgraphunit.c (cgraph_node::finalize_function): When
!flag_toplevel_reorde set no_reorder flag.
(varpool_node::finalize_decl): Likewise.
(symbol_table::compile): Drop no toplevel reorder path.
2017-07-06 Jan Hubicka <hubicka@ucw.cz>
* bb-reorder.c (better_edge_p): Do not build traces across abnormal/eh * bb-reorder.c (better_edge_p): Do not build traces across abnormal/eh
edges; zero probability is not better than uninitialized. edges; zero probability is not better than uninitialized.
......
...@@ -449,6 +449,8 @@ cgraph_node::finalize_function (tree decl, bool no_collect) ...@@ -449,6 +449,8 @@ cgraph_node::finalize_function (tree decl, bool no_collect)
node->definition = true; node->definition = true;
notice_global_symbol (decl); notice_global_symbol (decl);
node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL; node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL;
if (!flag_toplevel_reorder)
node->no_reorder = true;
/* With -fkeep-inline-functions we are keeping all inline functions except /* With -fkeep-inline-functions we are keeping all inline functions except
for extern inline ones. */ for extern inline ones. */
...@@ -471,7 +473,8 @@ cgraph_node::finalize_function (tree decl, bool no_collect) ...@@ -471,7 +473,8 @@ cgraph_node::finalize_function (tree decl, bool no_collect)
declared inline and nested functions. These were optimized out declared inline and nested functions. These were optimized out
in the original implementation and it is unclear whether we want in the original implementation and it is unclear whether we want
to change the behavior here. */ to change the behavior here. */
if (((!opt_for_fn (decl, optimize) || flag_keep_static_functions) if (((!opt_for_fn (decl, optimize) || flag_keep_static_functions
|| node->no_reorder)
&& !node->cpp_implicit_alias && !node->cpp_implicit_alias
&& !DECL_DISREGARD_INLINE_LIMITS (decl) && !DECL_DISREGARD_INLINE_LIMITS (decl)
&& !DECL_DECLARED_INLINE_P (decl) && !DECL_DECLARED_INLINE_P (decl)
...@@ -840,13 +843,13 @@ varpool_node::finalize_decl (tree decl) ...@@ -840,13 +843,13 @@ varpool_node::finalize_decl (tree decl)
it is available to notice_global_symbol. */ it is available to notice_global_symbol. */
node->definition = true; node->definition = true;
notice_global_symbol (decl); notice_global_symbol (decl);
if (!flag_toplevel_reorder)
node->no_reorder = true;
if (TREE_THIS_VOLATILE (decl) || DECL_PRESERVE_P (decl) if (TREE_THIS_VOLATILE (decl) || DECL_PRESERVE_P (decl)
/* Traditionally we do not eliminate static variables when not /* Traditionally we do not eliminate static variables when not
optimizing and when not doing toplevel reoder. */ optimizing and when not doing toplevel reoder. */
|| node->no_reorder || (node->no_reorder && !DECL_COMDAT (node->decl)
|| ((!flag_toplevel_reorder && !DECL_ARTIFICIAL (node->decl)))
&& !DECL_COMDAT (node->decl)
&& !DECL_ARTIFICIAL (node->decl))))
node->force_output = true; node->force_output = true;
if (symtab->state == CONSTRUCTION if (symtab->state == CONSTRUCTION
...@@ -857,8 +860,8 @@ varpool_node::finalize_decl (tree decl) ...@@ -857,8 +860,8 @@ varpool_node::finalize_decl (tree decl)
/* Some frontends produce various interface variables after compilation /* Some frontends produce various interface variables after compilation
finished. */ finished. */
if (symtab->state == FINISHED if (symtab->state == FINISHED
|| (!flag_toplevel_reorder || (node->no_reorder
&& symtab->state == EXPANSION)) && symtab->state == EXPANSION))
node->assemble_decl (); node->assemble_decl ();
if (DECL_INITIAL (decl)) if (DECL_INITIAL (decl))
...@@ -2226,11 +2229,10 @@ struct cgraph_order_sort ...@@ -2226,11 +2229,10 @@ struct cgraph_order_sort
according to their order fields, which is the order in which they according to their order fields, which is the order in which they
appeared in the file. This implements -fno-toplevel-reorder. In appeared in the file. This implements -fno-toplevel-reorder. In
this mode we may output functions and variables which don't really this mode we may output functions and variables which don't really
need to be output. need to be output. */
When NO_REORDER is true only do this for symbols marked no reorder. */
static void static void
output_in_order (bool no_reorder) output_in_order (void)
{ {
int max; int max;
cgraph_order_sort *nodes; cgraph_order_sort *nodes;
...@@ -2245,7 +2247,7 @@ output_in_order (bool no_reorder) ...@@ -2245,7 +2247,7 @@ output_in_order (bool no_reorder)
{ {
if (pf->process && !pf->thunk.thunk_p && !pf->alias) if (pf->process && !pf->thunk.thunk_p && !pf->alias)
{ {
if (no_reorder && !pf->no_reorder) if (!pf->no_reorder)
continue; continue;
i = pf->order; i = pf->order;
gcc_assert (nodes[i].kind == ORDER_UNDEFINED); gcc_assert (nodes[i].kind == ORDER_UNDEFINED);
...@@ -2258,7 +2260,7 @@ output_in_order (bool no_reorder) ...@@ -2258,7 +2260,7 @@ output_in_order (bool no_reorder)
Please keep them in sync. */ Please keep them in sync. */
FOR_EACH_VARIABLE (pv) FOR_EACH_VARIABLE (pv)
{ {
if (no_reorder && !pv->no_reorder) if (!pv->no_reorder)
continue; continue;
if (DECL_HARD_REGISTER (pv->decl) if (DECL_HARD_REGISTER (pv->decl)
|| DECL_HAS_VALUE_EXPR_P (pv->decl)) || DECL_HAS_VALUE_EXPR_P (pv->decl))
...@@ -2532,16 +2534,11 @@ symbol_table::compile (void) ...@@ -2532,16 +2534,11 @@ symbol_table::compile (void)
state = EXPANSION; state = EXPANSION;
if (!flag_toplevel_reorder) /* Output first asm statements and anything ordered. The process
output_in_order (false); flag is cleared for these nodes, so we skip them later. */
else output_in_order ();
{ expand_all_functions ();
/* Output first asm statements and anything ordered. The process output_variables ();
flag is cleared for these nodes, so we skip them later. */
output_in_order (true);
expand_all_functions ();
output_variables ();
}
process_new_functions (); process_new_functions ();
state = FINISHED; state = FINISHED;
......
2017-06-23 Marc Glisse <marc.glisse@inria.fr> 2017-07-06 Jan Hubicka <hubicka@ucw.cz>
* lto-partition.c (lto_balanced_map): Do not check
flag_toplevel_reorder.
2017-06-23 Marc Glisse <marc.glisse@inria.fr>
* lto-lang.c (lto_init): Use builtin_structptr_types. * lto-lang.c (lto_init): Use builtin_structptr_types.
2017-06-15 Jan Hubicka <hubicka@ucw.cz> 2017-06-15 Jan Hubicka <hubicka@ucw.cz>
......
...@@ -506,7 +506,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -506,7 +506,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
/* Collect all variables that should not be reordered. */ /* Collect all variables that should not be reordered. */
FOR_EACH_VARIABLE (vnode) FOR_EACH_VARIABLE (vnode)
if (vnode->get_partitioning_class () == SYMBOL_PARTITION if (vnode->get_partitioning_class () == SYMBOL_PARTITION
&& (!flag_toplevel_reorder || vnode->no_reorder)) && vnode->no_reorder)
varpool_order.safe_push (vnode); varpool_order.safe_push (vnode);
n_varpool_nodes = varpool_order.length (); n_varpool_nodes = varpool_order.length ();
varpool_order.qsort (varpool_node_cmp); varpool_order.qsort (varpool_node_cmp);
...@@ -547,7 +547,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -547,7 +547,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
} }
add_sorted_nodes (next_nodes, partition); add_sorted_nodes (next_nodes, partition);
add_symbol_to_partition (partition, order[i]); if (!symbol_partitioned_p (order[i]))
add_symbol_to_partition (partition, order[i]);
if (!order[i]->alias) if (!order[i]->alias)
total_size -= ipa_fn_summaries->get (order[i])->size; total_size -= ipa_fn_summaries->get (order[i])->size;
...@@ -634,7 +635,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -634,7 +635,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
vnode = dyn_cast <varpool_node *> (ref->referred); vnode = dyn_cast <varpool_node *> (ref->referred);
if (!vnode->definition) if (!vnode->definition)
continue; continue;
if (!symbol_partitioned_p (vnode) && flag_toplevel_reorder if (!symbol_partitioned_p (vnode)
&& !vnode->no_reorder && !vnode->no_reorder
&& vnode->get_partitioning_class () == SYMBOL_PARTITION) && vnode->get_partitioning_class () == SYMBOL_PARTITION)
add_symbol_to_partition (partition, vnode); add_symbol_to_partition (partition, vnode);
...@@ -672,7 +673,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -672,7 +673,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
because it allows them to be removed. Coupling because it allows them to be removed. Coupling
with objects they refer to only helps to reduce with objects they refer to only helps to reduce
number of symbols promoted to hidden. */ number of symbols promoted to hidden. */
if (!symbol_partitioned_p (vnode) && flag_toplevel_reorder if (!symbol_partitioned_p (vnode)
&& !vnode->no_reorder && !vnode->no_reorder
&& !vnode->can_remove_if_no_refs_p () && !vnode->can_remove_if_no_refs_p ()
&& vnode->get_partitioning_class () == SYMBOL_PARTITION) && vnode->get_partitioning_class () == SYMBOL_PARTITION)
...@@ -767,14 +768,10 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -767,14 +768,10 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
next_nodes.truncate (0); next_nodes.truncate (0);
/* Varables that are not reachable from the code go into last partition. */ /* Varables that are not reachable from the code go into last partition. */
if (flag_toplevel_reorder) FOR_EACH_VARIABLE (vnode)
{ if (vnode->get_partitioning_class () == SYMBOL_PARTITION
FOR_EACH_VARIABLE (vnode) && !symbol_partitioned_p (vnode))
if (vnode->get_partitioning_class () == SYMBOL_PARTITION next_nodes.safe_push (vnode);
&& !symbol_partitioned_p (vnode)
&& !vnode->no_reorder)
next_nodes.safe_push (vnode);
}
/* Output remaining ordered symbols. */ /* Output remaining ordered symbols. */
while (varpool_pos < n_varpool_nodes) while (varpool_pos < n_varpool_nodes)
......
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