callgraph or IPA reference edge leaving the partition contributes into
COST. Every edge inside partition was earlier computed as one leaving
it and thus we need to subtract it from COST. */
- while (last_visited_node < lto_symtab_encoder_size (partition->encoder))
+ for (; last_visited_node < lto_symtab_encoder_size (partition->encoder);
+ last_visited_node++)
{
int j;
struct ipa_ref *ref = NULL;
{
struct cgraph_edge *edge;
-
- last_visited_node++;
-
gcc_assert (node->definition || node->weakref);
/* Compute boundary cost of callgraph edges. */
gcc_assert (edge_cost > 0);
index = lto_symtab_encoder_lookup (partition->encoder,
edge->callee);
- if (index != LCC_NOT_FOUND
- && index < last_visited_node - 1)
+ if (index != LCC_NOT_FOUND && index < last_visited_node)
cost -= edge_cost, internal += edge_cost;
else
cost += edge_cost;
gcc_assert (edge_cost > 0);
index = lto_symtab_encoder_lookup (partition->encoder,
edge->caller);
- if (index != LCC_NOT_FOUND
- && index < last_visited_node - 1)
+ if (index != LCC_NOT_FOUND && index < last_visited_node)
cost -= edge_cost, internal += edge_cost;
else
cost += edge_cost;
}
}
- else
- last_visited_node++;
/* Compute boundary cost of IPA REF edges and at the same time look into
variables referenced from current partition and try to add them. */
add_symbol_to_partition (partition, vnode);
index = lto_symtab_encoder_lookup (partition->encoder,
vnode);
- if (index != LCC_NOT_FOUND
- && index < last_visited_node - 1)
+ if (index != LCC_NOT_FOUND && index < last_visited_node)
cost--, internal++;
else
cost++;
node = dyn_cast <cgraph_node *> (ref->referred);
index = lto_symtab_encoder_lookup (partition->encoder,
node);
- if (index != LCC_NOT_FOUND
- && index < last_visited_node - 1)
+ if (index != LCC_NOT_FOUND && index < last_visited_node)
cost--, internal++;
else
cost++;
add_symbol_to_partition (partition, vnode);
index = lto_symtab_encoder_lookup (partition->encoder,
vnode);
- if (index != LCC_NOT_FOUND
- && index < last_visited_node - 1)
+ if (index != LCC_NOT_FOUND && index < last_visited_node)
cost--, internal++;
else
cost++;
gcc_assert (node->definition);
index = lto_symtab_encoder_lookup (partition->encoder,
node);
- if (index != LCC_NOT_FOUND
- && index < last_visited_node - 1)
+ if (index != LCC_NOT_FOUND && index < last_visited_node)
cost--, internal++;
else
cost++;