Before, when we were deleting a cf node that was a block, we were first
removing all the instructions and then calling cleanup_cf_node(), at
which point cleanup_cf_node() couldn't do its job. Just move it before
everything else, which should be ok for the non-block case too.

v2: split out from previous commit
Signed-off-by: Connor Abbott <[email protected]>
---
 src/glsl/nir/nir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 704553f..a2b5e7c 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -1253,6 +1253,8 @@ nir_cf_node_remove(nir_cf_node *node)
    nir_function_impl *impl = nir_cf_node_get_function(node);
    nir_metadata_preserve(impl, nir_metadata_none);
 
+   cleanup_cf_node(node, impl);
+
    if (node->type == nir_cf_node_block) {
       /*
        * Basic blocks can't really be removed by themselves, since they act as
@@ -1274,8 +1276,6 @@ nir_cf_node_remove(nir_cf_node *node)
       exec_node_remove(&node->node);
       stitch_blocks(before_block, after_block);
    }
-
-   cleanup_cf_node(node);
 }
 
 static bool
-- 
2.1.0

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to