diff options
author | Martin Liska <mliska@suse.cz> | 2018-06-08 14:26:57 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-06-08 12:26:57 +0000 |
commit | 746447567a82ce2987f579770fd296ace60f87b1 (patch) | |
tree | c22de406a2a163de859df4f8b0c31de0e34a74a3 /gcc/lto | |
parent | 9d3e0adc2a0e657b2aa384f1392dd2fac77a62d4 (diff) | |
download | gcc-746447567a82ce2987f579770fd296ace60f87b1.zip gcc-746447567a82ce2987f579770fd296ace60f87b1.tar.gz gcc-746447567a82ce2987f579770fd296ace60f87b1.tar.bz2 |
Remove cgraph_node::summary_uid and make cgraph_node::uid really unique.
2018-06-08 Martin Liska <mliska@suse.cz>
* cgraph.c (cgraph_node::remove): Do not recycle uid.
* cgraph.h (symbol_table::release_symbol): Do not pass uid.
(symbol_table::allocate_cgraph_symbol): Do not set uid.
* passes.c (uid_hash_t): Record removed_nodes by their uids.
(remove_cgraph_node_from_order): Use the removed_nodes set.
(do_per_function_toporder): Likwise.
* symbol-summary.h (symtab_insertion): Use cgraph_node::uid
instead of summary_uid.
(symtab_removal): Likewise.
(symtab_duplication): Likewise.
2018-06-08 Martin Liska <mliska@suse.cz>
* lto-partition.c (lto_balanced_map): Use cgraph_node::uid
instead of summary_uid.
From-SVN: r261315
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/lto/lto-partition.c | 26 |
2 files changed, 16 insertions, 15 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 5004a30..aaf375b 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,5 +1,10 @@ 2018-06-08 Martin Liska <mliska@suse.cz> + * lto-partition.c (lto_balanced_map): Use cgraph_node::uid + instead of summary_uid. + +2018-06-08 Martin Liska <mliska@suse.cz> + * lto-partition.c (add_symbol_to_partition_1): Use get_create instead of get. (undo_partition): Likewise. diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 1cca082..006eec7 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -500,12 +500,10 @@ account_reference_p (symtab_node *n1, symtab_node *n2) void lto_balanced_map (int n_lto_partitions, int max_partition_size) { - int n_nodes = 0; int n_varpool_nodes = 0, varpool_pos = 0, best_varpool_pos = 0; - struct cgraph_node **order = XNEWVEC (cgraph_node *, symtab->cgraph_max_uid); + auto_vec <cgraph_node *> order (symtab->cgraph_count); auto_vec<cgraph_node *> noreorder; auto_vec<varpool_node *> varpool_order; - int i; struct cgraph_node *node; int64_t original_total_size, total_size = 0; int64_t partition_size; @@ -513,7 +511,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) int last_visited_node = 0; varpool_node *vnode; int64_t cost = 0, internal = 0; - int best_n_nodes = 0, best_i = 0; + unsigned int best_n_nodes = 0, best_i = 0; int64_t best_cost = -1, best_internal = 0, best_size = 0; int npartitions; int current_order = -1; @@ -521,14 +519,14 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) FOR_EACH_VARIABLE (vnode) gcc_assert (!vnode->aux); - + FOR_EACH_DEFINED_FUNCTION (node) if (node->get_partitioning_class () == SYMBOL_PARTITION) { if (node->no_reorder) noreorder.safe_push (node); else - order[n_nodes++] = node; + order.safe_push (node); if (!node->alias) total_size += ipa_fn_summaries->get_create (node)->size; } @@ -540,15 +538,15 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) unit tends to import a lot of global trees defined there. We should get better about minimizing the function bounday, but until that things works smoother if we order in source order. */ - qsort (order, n_nodes, sizeof (struct cgraph_node *), node_cmp); + order.qsort (node_cmp); noreorder.qsort (node_cmp); if (symtab->dump_file) { - for(i = 0; i < n_nodes; i++) + for (unsigned i = 0; i < order.length (); i++) fprintf (symtab->dump_file, "Balanced map symbol order:%s:%u\n", order[i]->name (), order[i]->tp_first_run); - for(i = 0; i < (int)noreorder.length(); i++) + for (unsigned i = 0; i < noreorder.length (); i++) fprintf (symtab->dump_file, "Balanced map symbol no_reorder:%s:%u\n", noreorder[i]->name (), noreorder[i]->tp_first_run); } @@ -577,7 +575,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) auto_vec<symtab_node *> next_nodes; - for (i = 0; i < n_nodes; i++) + for (unsigned i = 0; i < order.length (); i++) { if (symbol_partitioned_p (order[i])) continue; @@ -792,9 +790,9 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) "Partition insns: %i (want %" PRId64 ")\n", partition->insns, partition_size); /* When we are finished, avoid creating empty partition. */ - while (i < n_nodes - 1 && symbol_partitioned_p (order[i + 1])) + while (i < order.length () - 1 && symbol_partitioned_p (order[i + 1])) i++; - if (i == n_nodes - 1) + if (i == order.length () - 1) break; total_size -= partition->insns; partition = new_partition (""); @@ -842,8 +840,6 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) gcc_assert (next_nodes.length () || npartitions != 1 || !best_cost || best_cost == -1); add_sorted_nodes (next_nodes, partition); - free (order); - if (symtab->dump_file) { fprintf (symtab->dump_file, "\nPartition sizes:\n"); @@ -854,7 +850,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ltrans_partition p = ltrans_partitions[i]; fprintf (symtab->dump_file, "partition %d contains %d (%2.2f%%)" " symbols and %d (%2.2f%%) insns\n", i, p->symbols, - 100.0 * p->symbols / n_nodes, p->insns, + 100.0 * p->symbols / order.length (), p->insns, 100.0 * p->insns / original_total_size); } |