[Mesa-dev] [PATCH 03/11] nir: Only unlink sources that are actually valid

Jason Ekstrand jason at jlekstrand.net
Wed Sep 9 17:50:06 PDT 2015


---
 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 9a22fea..e173b21 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -714,9 +714,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;
 }
@@ -1099,12 +1106,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.5.0.400.gff86faf



More information about the mesa-dev mailing list