Commit 937f7f69 by Jan Hubicka Committed by Jan Hubicka

* lto.c (lto_balanced_map): Fix accounting of program size.

From-SVN: r165145
parent 1b3fad81
2010-10-06 Jan Hubicka <jh@suse.cz> 2010-10-06 Jan Hubicka <jh@suse.cz>
* lto.c (lto_balanced_map): Fix accounting of program size.
2010-10-06 Jan Hubicka <jh@suse.cz>
* lto.c (lto_balanced_map): Do not produce empty partitions. * lto.c (lto_balanced_map): Do not produce empty partitions.
2010-10-06 Andi Kleen <ak@linux.intel.com> 2010-10-06 Andi Kleen <ak@linux.intel.com>
......
...@@ -995,7 +995,7 @@ lto_balanced_map (void) ...@@ -995,7 +995,7 @@ lto_balanced_map (void)
struct cgraph_node **order = XNEWVEC (struct cgraph_node *, cgraph_max_uid); struct cgraph_node **order = XNEWVEC (struct cgraph_node *, cgraph_max_uid);
int i, postorder_len; int i, postorder_len;
struct cgraph_node *node; struct cgraph_node *node;
int total_size = 0; int total_size = 0, best_total_size = 0;
int partition_size; int partition_size;
ltrans_partition partition; ltrans_partition partition;
unsigned int last_visited_cgraph_node = 0, last_visited_varpool_node = 0; unsigned int last_visited_cgraph_node = 0, last_visited_varpool_node = 0;
...@@ -1017,7 +1017,7 @@ lto_balanced_map (void) ...@@ -1017,7 +1017,7 @@ lto_balanced_map (void)
if (partition_cgraph_node_p (node)) if (partition_cgraph_node_p (node))
{ {
order[n_nodes++] = node; order[n_nodes++] = node;
total_size += node->local.inline_summary.self_size; total_size += node->global.size;
} }
} }
free (postorder); free (postorder);
...@@ -1035,6 +1035,7 @@ lto_balanced_map (void) ...@@ -1035,6 +1035,7 @@ lto_balanced_map (void)
for (i = 0; i < n_nodes; i++) for (i = 0; i < n_nodes; i++)
{ {
add_cgraph_node_to_partition (partition, order[i]); add_cgraph_node_to_partition (partition, order[i]);
total_size -= order[i]->global.size;
/* Once we added a new node to the partition, we also want to add /* Once we added a new node to the partition, we also want to add
all referenced variables unless they was already added into some all referenced variables unless they was already added into some
...@@ -1069,7 +1070,6 @@ lto_balanced_map (void) ...@@ -1069,7 +1070,6 @@ lto_balanced_map (void)
last_visited_cgraph_node); last_visited_cgraph_node);
refs = &node->ref_list; refs = &node->ref_list;
total_size -= node->local.inline_summary.self_size;
last_visited_cgraph_node++; last_visited_cgraph_node++;
gcc_assert (node->analyzed); gcc_assert (node->analyzed);
...@@ -1195,6 +1195,7 @@ lto_balanced_map (void) ...@@ -1195,6 +1195,7 @@ lto_balanced_map (void)
partition->cgraph_set->nodes); partition->cgraph_set->nodes);
best_n_varpool_nodes = VEC_length (varpool_node_ptr, best_n_varpool_nodes = VEC_length (varpool_node_ptr,
partition->varpool_set->nodes); partition->varpool_set->nodes);
best_total_size = total_size;
} }
if (cgraph_dump_file) if (cgraph_dump_file)
fprintf (cgraph_dump_file, "Step %i: added %s, size %i, cost %i/%i best %i/%i, step %i\n", i, fprintf (cgraph_dump_file, "Step %i: added %s, size %i, cost %i/%i best %i/%i, step %i\n", i,
...@@ -1218,6 +1219,7 @@ lto_balanced_map (void) ...@@ -1218,6 +1219,7 @@ lto_balanced_map (void)
partition = new_partition (""); partition = new_partition ("");
last_visited_cgraph_node = 0; last_visited_cgraph_node = 0;
last_visited_varpool_node = 0; last_visited_varpool_node = 0;
total_size = best_total_size;
cost = 0; cost = 0;
if (cgraph_dump_file) if (cgraph_dump_file)
......
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