diff options
author | Jason Ekstrand <[email protected]> | 2019-05-22 18:01:14 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-05-31 01:08:03 +0000 |
commit | 911ea2c66fc54c5066707f7fe4451ec573792ae7 (patch) | |
tree | a85cd25101c920b89f06e259f86e14e09443a913 | |
parent | e84194686d1234f9c6e9ba02d223a61ad3ca7b6a (diff) |
nir/vars_to_ssa: Use a non-null UNDEF_NODE pointer
We're about to change the meaning of get_deref_node returning NULL so we
need a non-NULL value to mean properly undefined.
Reviewed-by: Dave Airlie <[email protected]>
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
-rw-r--r-- | src/compiler/nir/nir_lower_vars_to_ssa.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 8771910f7e5..b1b26c1fbf2 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c @@ -61,6 +61,8 @@ struct deref_node { struct deref_node *children[0]; }; +#define UNDEF_NODE ((struct deref_node *)(uintptr_t)1) + struct lower_variables_state { nir_shader *shader; void *dead_ctx; @@ -169,7 +171,7 @@ get_deref_node_recur(nir_deref_instr *deref, * somewhat gracefully. */ if (index >= glsl_get_length(parent->type)) - return NULL; + return UNDEF_NODE; if (parent->children[index] == NULL) { parent->children[index] = @@ -508,7 +510,7 @@ rename_variables(struct lower_variables_state *state) continue; struct deref_node *node = get_deref_node(deref, state); - if (node == NULL) { + if (node == UNDEF_NODE) { /* If we hit this path then we are referencing an invalid * value. Most likely, we unrolled something and are * reading past the end of some array. In any case, this @@ -562,7 +564,7 @@ rename_variables(struct lower_variables_state *state) assert(intrin->src[1].is_ssa); nir_ssa_def *value = intrin->src[1].ssa; - if (node == NULL) { + if (node == UNDEF_NODE) { /* Probably an out-of-bounds array store. That should be a * no-op. */ nir_instr_remove(&intrin->instr); |