nir/opt_undef: fixup for new foreach_block()
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 12 Apr 2016 18:46:03 +0000 (14:46 -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_opt_undef.c

index 38208f8476f3cfa62e8db54930851abe48509634..87c23b3c63f7b9f34f9fa644f15791482c2c78e9 100644 (file)
@@ -71,20 +71,6 @@ opt_undef_alu(nir_alu_instr *instr)
    return false;
 }
 
-static bool
-opt_undef_block(nir_block *block, void *data)
-{
-   bool *progress = data;
-
-   nir_foreach_instr_safe(block, instr) {
-      if (instr->type == nir_instr_type_alu)
-         if (opt_undef_alu(nir_instr_as_alu(instr)))
-             (*progress) = true;
-   }
-
-   return true;
-}
-
 bool
 nir_opt_undef(nir_shader *shader)
 {
@@ -92,7 +78,14 @@ nir_opt_undef(nir_shader *shader)
 
    nir_foreach_function(shader, function) {
       if (function->impl) {
-         nir_foreach_block_call(function->impl, opt_undef_block, &progress);
+         nir_foreach_block(block, function->impl) {
+            nir_foreach_instr_safe(block, instr) {
+               if (instr->type == nir_instr_type_alu)
+                  if (opt_undef_alu(nir_instr_as_alu(instr)))
+                      progress = true;
+            }
+         }
+
          if (progress)
             nir_metadata_preserve(function->impl,
                                   nir_metadata_block_index |