nir: Use nir_builder in nir_lower_io's get_io_offset().
[mesa.git] / src / glsl / nir / nir_live_variables.c
index f110c5e47ab959ef688185b57fcfb82302e570aa..1c96dcf36c5ce2afc1d3dcc6bebccf90205407bb 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "nir.h"
 #include "nir_worklist.h"
+#include "nir_vla.h"
 
 /*
  * Basic liveness analysis.  This works only in SSA form.
@@ -130,8 +131,8 @@ static bool
 propagate_across_edge(nir_block *pred, nir_block *succ,
                       struct live_variables_state *state)
 {
-   BITSET_WORD live[state->bitset_words];
-   memcpy(live, succ->live_in, sizeof live);
+   NIR_VLA(BITSET_WORD, live, state->bitset_words);
+   memcpy(live, succ->live_in, state->bitset_words * sizeof *live);
 
    nir_foreach_instr(succ, instr) {
       if (instr->type != nir_instr_type_phi)
@@ -147,7 +148,7 @@ propagate_across_edge(nir_block *pred, nir_block *succ,
          break;
       nir_phi_instr *phi = nir_instr_as_phi(instr);
 
-      foreach_list_typed(nir_phi_src, src, node, &phi->srcs) {
+      nir_foreach_phi_src(phi, src) {
          if (src->pred == pred) {
             set_src_live(&src->src, live);
             break;