nir/remove_dead_variables: fixup for new foreach_block()
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 12 Apr 2016 19:14:04 +0000 (15:14 -0400)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 Apr 2016 22:52:17 +0000 (15:52 -0700)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_remove_dead_variables.c

index 22a286f041faab9a7cce844c7eaf8d4c857de52a..c48fa40c07fee94394b013af9c16c7ff75061c09 100644 (file)
@@ -65,39 +65,31 @@ add_var_use_tex(nir_tex_instr *instr, struct set *live)
    }
 }
 
-static bool
-add_var_use_block(nir_block *block, void *state)
-{
-   struct set *live = state;
-
-   nir_foreach_instr(block, instr) {
-      switch(instr->type) {
-      case nir_instr_type_intrinsic:
-         add_var_use_intrinsic(nir_instr_as_intrinsic(instr), live);
-         break;
-
-      case nir_instr_type_call:
-         add_var_use_call(nir_instr_as_call(instr), live);
-         break;
-
-      case nir_instr_type_tex:
-         add_var_use_tex(nir_instr_as_tex(instr), live);
-         break;
-
-      default:
-         break;
-      }
-   }
-
-   return true;
-}
-
 static void
 add_var_use_shader(nir_shader *shader, struct set *live)
 {
    nir_foreach_function(shader, function) {
       if (function->impl) {
-         nir_foreach_block_call(function->impl, add_var_use_block, live);
+         nir_foreach_block(block, function->impl) {
+            nir_foreach_instr(block, instr) {
+               switch(instr->type) {
+               case nir_instr_type_intrinsic:
+                  add_var_use_intrinsic(nir_instr_as_intrinsic(instr), live);
+                  break;
+
+               case nir_instr_type_call:
+                  add_var_use_call(nir_instr_as_call(instr), live);
+                  break;
+
+               case nir_instr_type_tex:
+                  add_var_use_tex(nir_instr_as_tex(instr), live);
+                  break;
+
+               default:
+                  break;
+               }
+            }
+         }
       }
    }
 }