[Mesa-dev] [PATCH 35/47] nir/opt_cp: use nir_block_get_following_if()

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


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

diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c
index d99f78d..c1a84c2 100644
--- a/src/compiler/nir/nir_opt_copy_propagate.c
+++ b/src/compiler/nir/nir_opt_copy_propagate.c
@@ -241,22 +241,18 @@ copy_prop_if(nir_if *if_stmt)
 }
 
 static bool
-copy_prop_block(nir_block *block, void *_state)
+copy_prop_block(nir_block *block)
 {
-   bool *progress = (bool *) _state;
+   bool *progress = false;
 
    nir_foreach_instr(block, instr) {
       if (copy_prop_instr(instr))
          *progress = true;
    }
 
-   if (block->cf_node.node.next != NULL && /* check that we aren't the end node */
-       !nir_cf_node_is_last(&block->cf_node) &&
-       nir_cf_node_next(&block->cf_node)->type == nir_cf_node_if) {
-      nir_if *if_stmt = nir_cf_node_as_if(nir_cf_node_next(&block->cf_node));
-      if (copy_prop_if(if_stmt))
+   nir_if *if_stmt = nir_block_get_following_if(block);
+   if (if_stmt && copy_prop_if(if_stmt))
          *progress = true;
-   }
 
    return true;
 }
-- 
2.5.0



More information about the mesa-dev mailing list