broadcom/vc5: Re-do live variables after removing thrsws.
authorEric Anholt <eric@anholt.net>
Sat, 24 Feb 2018 01:46:35 +0000 (17:46 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 19 Mar 2018 23:42:59 +0000 (16:42 -0700)
Otherwise our start/ends ips won't line up with the actual instructions.

src/broadcom/compiler/nir_to_vir.c
src/broadcom/compiler/vir_live_variables.c

index 595689d24416a45455fb1ef7d175bf8666732a1e..a8098fc320903f0223dd72be9a9acb3614bd5eb2 100644 (file)
@@ -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;
 }
index 217b716fd9fa8233fd98ec2f7cab5cc9796c0e46..20acace1faf93043474ee3923e77440075c2ec5b 100644 (file)
@@ -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);