From: Jason Ekstrand Date: Wed, 9 Sep 2015 22:58:08 +0000 (-0700) Subject: nir: Only unlink sources that are actually valid X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=106a3b2cc33c53ab16ffedc51248b04dd995dc17;p=mesa.git nir: Only unlink sources that are actually valid Reviewed-by: Thomas Helland --- 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) {