[Mesa-dev] [PATCH 36/47] nir/opt_cp: fixup for new foreach_block()

Connor Abbott cwabbott0 at gmail.com
Wed Apr 13 04:35:15 UTC 2016


Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
---
 src/compiler/nir/nir_opt_copy_propagate.c | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c
index c1a84c2..782a198 100644
--- a/src/compiler/nir/nir_opt_copy_propagate.c
+++ b/src/compiler/nir/nir_opt_copy_propagate.c
@@ -241,28 +241,20 @@ copy_prop_if(nir_if *if_stmt)
 }
 
 static bool
-copy_prop_block(nir_block *block)
-{
-   bool *progress = false;
-
-   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(impl, copy_prop_block, &progress);
+   nir_foreach_block(impl, block) {
+      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 |
-- 
2.5.0



More information about the mesa-dev mailing list