[Mesa-dev] [PATCH v2 04/14] nir: properly clean up jumps when removing cf nodes

Connor Abbott cwabbott0 at gmail.com
Thu May 21 09:40:59 PDT 2015


Before, we might have left dangling predecessors from jumps that were
going to be removed.

v2: split out from "nir: insert ssa_undef instructions when cleaning up
    defs/uses"

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

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index a2b5e7c..dc6d63f 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -1214,9 +1214,15 @@ cleanup_cf_node(nir_cf_node *node, nir_function_impl *impl)
    switch (node->type) {
    case nir_cf_node_block: {
       nir_block *block = nir_cf_node_as_block(node);
-      /* We need to walk the instructions and clean up defs/uses */
-      nir_foreach_instr(block, instr)
+      /* We need to walk the instructions and clean up defs/uses,
+       * as well as clean up any jumps to control flow that may not be getting
+       * deleted.
+       */
+      nir_foreach_instr(block, instr) {
+         if (instr->type == nir_instr_type_jump)
+            handle_remove_jump(block, nir_instr_as_jump(instr)->type);
          remove_defs_uses(instr, impl);
+      }
       break;
    }
 
-- 
2.1.0



More information about the mesa-dev mailing list