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 <cwabbo...@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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to