From 106a3b2cc33c53ab16ffedc51248b04dd995dc17 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 9 Sep 2015 15:58:08 -0700 Subject: [PATCH] nir: Only unlink sources that are actually valid Reviewed-by: Thomas Helland --- src/glsl/nir/nir.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 13489f0d38e..4a88cd1837c 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -716,10 +716,17 @@ nir_instr_insert(nir_cursor cursor, nir_instr *instr) nir_handle_add_jump(instr->block); } +static bool +src_is_valid(const nir_src *src) +{ + return src->is_ssa ? (src->ssa != NULL) : (src->reg.reg != NULL); +} + static bool remove_use_cb(nir_src *src, void *state) { - list_del(&src->use_link); + if (src_is_valid(src)) + list_del(&src->use_link); return true; } @@ -1102,12 +1109,6 @@ nir_srcs_equal(nir_src src1, nir_src src2) } } -static bool -src_is_valid(const nir_src *src) -{ - return src->is_ssa ? (src->ssa != NULL) : (src->reg.reg != NULL); -} - static void src_remove_all_uses(nir_src *src) { -- 2.30.2