summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-09-09 15:58:08 -0700
committerJason Ekstrand <[email protected]>2015-09-11 09:21:20 -0700
commit106a3b2cc33c53ab16ffedc51248b04dd995dc17 (patch)
tree1ded29c270f7bd8d7cfda128031d33da4f46fd81
parenta4aa25be1e0a27b1a6a6b0bcf576beb9dfe1ea7a (diff)
nir: Only unlink sources that are actually valid
Reviewed-by: Thomas Helland <[email protected]>
-rw-r--r--src/glsl/nir/nir.c15
1 files 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
@@ -717,9 +717,16 @@ nir_instr_insert(nir_cursor cursor, nir_instr *instr)
}
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)
{