diff options
author | Jason Ekstrand <[email protected]> | 2018-07-08 21:55:40 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-08-22 14:17:38 -0500 |
commit | 68ae66542a1537bc0a533cae870b2523523d8b6e (patch) | |
tree | 05ba2750d05670499f178ce6e9b9f4b92ca2c3ba /src/compiler | |
parent | e80e8d7adc5f497b7d25978611b8cdca7458b47c (diff) |
nir/vars_to_ssa: Don't build deref nodes for non-local variables
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_lower_vars_to_ssa.c | 18 |
1 files changed, 14 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 3f37acaed33..cd679be5be5 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c @@ -206,6 +206,12 @@ get_deref_node_recur(nir_deref_instr *deref, static struct deref_node * get_deref_node(nir_deref_instr *deref, struct lower_variables_state *state) { + /* This pass only works on local variables. Just ignore any derefs with + * a non-local mode. + */ + if (deref->mode != nir_var_local) + return NULL; + struct deref_node *node = get_deref_node_recur(deref, state); if (!node) return NULL; @@ -506,6 +512,9 @@ rename_variables(struct lower_variables_state *state) switch (intrin->intrinsic) { case nir_intrinsic_load_deref: { nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]); + if (deref->mode != nir_var_local) + continue; + struct deref_node *node = get_deref_node(deref, state); if (node == NULL) { /* If we hit this path then we are referencing an invalid @@ -553,6 +562,9 @@ rename_variables(struct lower_variables_state *state) case nir_intrinsic_store_deref: { nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]); + if (deref->mode != nir_var_local) + continue; + struct deref_node *node = get_deref_node(deref, state); assert(intrin->src[1].is_ssa); @@ -678,10 +690,8 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl) assert(path->path[0]->deref_type == nir_deref_type_var); nir_variable *var = path->path[0]->var; - if (var->data.mode != nir_var_local) { - exec_node_remove(&node->direct_derefs_link); - continue; - } + /* We don't build deref nodes for non-local variables */ + assert(var->data.mode == nir_var_local); if (path_may_be_aliased(path, &state)) { exec_node_remove(&node->direct_derefs_link); |