# Pastebin NnS25OPi diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c index e9e8b6e9150..9396f3ff659 100644 --- a/src/util/register_allocate.c +++ b/src/util/register_allocate.c @@ -1011,17 +1011,17 @@ ra_set_node_reg(struct ra_graph *g, unsigned int n, unsigned int reg) } static float -ra_get_spill_benefit(struct ra_graph *g, unsigned int n) +ra_get_spill_benefit(struct ra_graph *g, struct ra_node *n) { float benefit = 0; - int n_class = g->nodes[n].class; + int n_class = n->class; /* Define the benefit of eliminating an interference between n, n2 * through spilling as q(C, B) / p(C). This is similar to the * "count number of edges" approach of traditional graph coloring, * but takes classes into account. */ - util_dynarray_foreach(&g->nodes[n].adjacency_list, unsigned int, n2p) { + util_dynarray_foreach(&n->adjacency_list, unsigned int, n2p) { unsigned int n2 = *n2p; unsigned int n2_class = g->nodes[n2].class; benefit += ((float)g->regs->classes[n_class]->q[n2_class] / @@ -1048,7 +1048,8 @@ ra_get_best_spill_node(struct ra_graph *g) * in us making progress. */ for (n = 0; n < g->count; n++) { - float cost = g->nodes[n].spill_cost; + struct ra_node *node = &g->nodes[n]; + float cost = node->spill_cost; float benefit; if (cost <= 0.0f) @@ -1057,7 +1058,7 @@ ra_get_best_spill_node(struct ra_graph *g) if (BITSET_TEST(g->tmp.in_stack, n)) continue; - benefit = ra_get_spill_benefit(g, n); + benefit = ra_get_spill_benefit(g, node); if (benefit / cost > best_benefit) { best_benefit = benefit / cost;