summaryrefslogtreecommitdiffstats
path: root/src/broadcom
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-02-23 17:46:35 -0800
committerEric Anholt <[email protected]>2018-03-19 16:42:59 -0700
commit55bf2983330dffafce53a2772cac078f4477988e (patch)
tree2e196d397f35115b997b1bfb3b227274911add12 /src/broadcom
parentc3a504f470b8116ebcd892ce1f48125549817467 (diff)
broadcom/vc5: Re-do live variables after removing thrsws.
Otherwise our start/ends ips won't line up with the actual instructions.
Diffstat (limited to 'src/broadcom')
-rw-r--r--src/broadcom/compiler/nir_to_vir.c1
-rw-r--r--src/broadcom/compiler/vir_live_variables.c16
2 files changed, 14 insertions, 3 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index 595689d2441..a8098fc3209 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -1929,6 +1929,7 @@ vir_remove_thrsw(struct v3d_compile *c)
vir_remove_instruction(c, inst);
}
}
+ vir_calculate_live_intervals(c);
c->last_thrsw = NULL;
}
diff --git a/src/broadcom/compiler/vir_live_variables.c b/src/broadcom/compiler/vir_live_variables.c
index 217b716fd9f..20acace1faf 100644
--- a/src/broadcom/compiler/vir_live_variables.c
+++ b/src/broadcom/compiler/vir_live_variables.c
@@ -311,10 +311,20 @@ vir_calculate_live_intervals(struct v3d_compile *c)
{
int bitset_words = BITSET_WORDS(c->num_temps);
- /* If we called this function more than once, then we should be
- * freeing the previous arrays.
+ /* We may be called more than once if we've rearranged the program to
+ * try to get register allocation to succeed.
*/
- assert(!c->temp_start);
+ if (c->temp_start) {
+ ralloc_free(c->temp_start);
+ ralloc_free(c->temp_end);
+
+ vir_for_each_block(block, c) {
+ ralloc_free(block->def);
+ ralloc_free(block->use);
+ ralloc_free(block->live_in);
+ ralloc_free(block->live_out);
+ }
+ }
c->temp_start = rzalloc_array(c, int, c->num_temps);
c->temp_end = rzalloc_array(c, int, c->num_temps);