[Mesa-dev] [PATCH 1/9] nir/vars_to_ssa: don't rewrite removed instructions

Connor Abbott cwabbott0 at gmail.com
Fri May 8 22:03:27 PDT 2015


We were rewriting the uses of the intrinsic instruction to point to
something else after removing it, which only happened to work since we
were lax about having dangling uses when removing instructions. Fix that
up.

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

diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c b/src/glsl/nir/nir_lower_vars_to_ssa.c
index ccb8f99..8d0ae1b 100644
--- a/src/glsl/nir/nir_lower_vars_to_ssa.c
+++ b/src/glsl/nir/nir_lower_vars_to_ssa.c
@@ -647,11 +647,12 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)
                               intrin->num_components, NULL);
 
             nir_instr_insert_before(&intrin->instr, &mov->instr);
-            nir_instr_remove(&intrin->instr);
 
             nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
                                      nir_src_for_ssa(&mov->dest.dest.ssa),
                                      state->shader);
+
+            nir_instr_remove(&intrin->instr);
             break;
          }
 
-- 
2.1.0



More information about the mesa-dev mailing list