nir/opt_cp: use nir_block_get_following_if()
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 12 Apr 2016 18:52:43 +0000 (14:52 -0400)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 27 Apr 2016 22:05:34 +0000 (15:05 -0700)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_opt_copy_propagate.c

index acae60e233fd317661b0bdcbc4abd23578ad38e4..6847e71b35e1db8d31e5276d34dfc20d48b46415 100644 (file)
@@ -250,13 +250,9 @@ copy_prop_block(nir_block *block, void *_state)
          *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))
-         *progress = true;
-   }
+   nir_if *if_stmt = nir_block_get_following_if(block);
+   if (if_stmt && copy_prop_if(if_stmt))
+      *progress = true;
 
    return true;
 }