summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>2019-06-03 14:13:16 -0700
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>2019-06-03 17:09:22 -0700
commitea0e89859c9f2e5f0b3055d822663b2ee5904cb3 (patch)
tree03c714f6f3afb208295ebc79900059ac953ffd24 /src/compiler
parentb2bbd1a27b9109a612ec5e072716692e8f91ef15 (diff)
downloadmesa-ea0e89859c9f2e5f0b3055d822663b2ee5904cb3.tar.gz
nir/vars_to_ssa: Handle UNDEF_NODE in more places
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110832 Fixes: 911ea2c66fc "nir/vars_to_ssa: Use a non-null UNDEF_NODE pointer" Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_vars_to_ssa.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c
index d04d84f9e20..4375f93dc3c 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -161,6 +161,9 @@ get_deref_node_recur(nir_deref_instr *deref,
if (parent == NULL)
return NULL;
+ if (parent == UNDEF_NODE)
+ return UNDEF_NODE;
+
switch (deref->deref_type) {
case nir_deref_type_struct:
assert(glsl_type_is_struct_or_ifc(parent->type));
@@ -232,7 +235,8 @@ get_deref_node(nir_deref_instr *deref, struct lower_variables_state *state)
* already in the list and we only bother for deref nodes which are used
* directly in a load or store.
*/
- if (node->is_direct && state->add_to_direct_deref_nodes &&
+ if (node != UNDEF_NODE && node->is_direct &&
+ state->add_to_direct_deref_nodes &&
node->direct_derefs_link.next == NULL) {
nir_deref_path_init(&node->path, deref, state->dead_ctx);
assert(deref->var != NULL);
@@ -404,7 +408,7 @@ register_load_instr(nir_intrinsic_instr *load_instr,
{
nir_deref_instr *deref = nir_src_as_deref(load_instr->src[0]);
struct deref_node *node = get_deref_node(deref, state);
- if (node == NULL)
+ if (node == NULL || node == UNDEF_NODE)
return;
if (node->loads == NULL)
@@ -419,7 +423,7 @@ register_store_instr(nir_intrinsic_instr *store_instr,
{
nir_deref_instr *deref = nir_src_as_deref(store_instr->src[0]);
struct deref_node *node = get_deref_node(deref, state);
- if (node == NULL)
+ if (node == NULL || node == UNDEF_NODE)
return;
if (node->stores == NULL)
@@ -435,7 +439,7 @@ register_copy_instr(nir_intrinsic_instr *copy_instr,
for (unsigned idx = 0; idx < 2; idx++) {
nir_deref_instr *deref = nir_src_as_deref(copy_instr->src[idx]);
struct deref_node *node = get_deref_node(deref, state);
- if (node == NULL)
+ if (node == NULL || node == UNDEF_NODE)
continue;
if (node->copies == NULL)