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

index 6847e71b35e1db8d31e5276d34dfc20d48b46415..99aebae686712ee7215b69a4761ba37c598f264b 100644 (file)
@@ -240,29 +240,21 @@ copy_prop_if(nir_if *if_stmt)
    return copy_prop_src(&if_stmt->condition, NULL, if_stmt);
 }
 
-static bool
-copy_prop_block(nir_block *block, void *_state)
-{
-   bool *progress = (bool *) _state;
-
-   nir_foreach_instr(block, instr) {
-      if (copy_prop_instr(instr))
-         *progress = true;
-   }
-
-   nir_if *if_stmt = nir_block_get_following_if(block);
-   if (if_stmt && copy_prop_if(if_stmt))
-      *progress = true;
-
-   return true;
-}
-
 static bool
 nir_copy_prop_impl(nir_function_impl *impl)
 {
    bool progress = false;
 
-   nir_foreach_block_call(impl, copy_prop_block, &progress);
+   nir_foreach_block(block, impl) {
+      nir_foreach_instr(block, instr) {
+         if (copy_prop_instr(instr))
+            progress = true;
+      }
+
+      nir_if *if_stmt = nir_block_get_following_if(block);
+      if (if_stmt && copy_prop_if(if_stmt))
+         progress = true;
+      }
 
    if (progress) {
       nir_metadata_preserve(impl, nir_metadata_block_index |