nir/vars_to_ssa: Use nir_deref_must_be

We can only lower a deref to SSA in this pass if it's guaranteed to be
nir_var_function_temp.  We already flag any variables with complex uses
(i.e. casts) as not being lowerable and refuse to lower any derefs to
them so we don't have to worry about false negatives.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>
This commit is contained in:
Jason Ekstrand 2020-11-01 17:40:34 -06:00 committed by Marge Bot
parent 0f94ff8a6a
commit 8a2cda1d53

View file

@ -224,7 +224,7 @@ 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_function_temp)
if (!nir_deref_mode_must_be(deref, nir_var_function_temp))
return NULL;
struct deref_node *node = get_deref_node_recur(deref, state);
@ -555,7 +555,7 @@ 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_function_temp)
if (!nir_deref_mode_must_be(deref, nir_var_function_temp))
continue;
struct deref_node *node = get_deref_node(deref, state);
@ -608,7 +608,7 @@ 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_function_temp)
if (!nir_deref_mode_must_be(deref, nir_var_function_temp))
continue;
struct deref_node *node = get_deref_node(deref, state);