[Mesa-dev] [PATCH 02/16] nir: add comment about nir_src_copy()

Rob Clark robdclark at gmail.com
Sat Apr 7 16:13:34 UTC 2018


So it is more clear about when to use nir_instr_rewrite_src()

Signed-off-by: Rob Clark <robdclark at gmail.com>
---
An assert would be nice too, but wasn't sure how to differentiate
between the parent_instr and parent_if case.

 src/compiler/nir/nir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index a827fe00e11..0f6cec728b0 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -207,6 +207,9 @@ nir_function_create(nir_shader *shader, const char *name)
    return func;
 }
 
+/* NOTE: if the instruction you are copying a src to is already added
+ * to the IR, use nir_instr_rewrite_src() instead.
+ */
 void nir_src_copy(nir_src *dest, const nir_src *src, void *mem_ctx)
 {
    dest->is_ssa = src->is_ssa;
-- 
2.14.3



More information about the mesa-dev mailing list