nir/deref: Don't try to compare derefs containing casts

One day, we may want copy_prop_vars or other passes to be able to see
through certain types of casts such as when someone casts a uint64_t to
a uvec2.  However, for now we should just avoid casts all together.

Fixes: d8e3edb784 "nir/deref: Support casts and ptr_as_array in..."
Tested-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/6072>
This commit is contained in:
Jason Ekstrand 2020-07-24 20:27:37 -05:00 committed by Marge Bot
parent ee2f21b10d
commit 611f654fcf
1 changed files with 6 additions and 4 deletions

View File

@ -516,8 +516,8 @@ nir_compare_deref_paths(nir_deref_path *a_path,
}
/* We're at either the tail or the divergence point between the two deref
* paths. Look to see if either contains a ptr_as_array deref. It it
* does we don't know how to safely make any inferences. Hopefully,
* paths. Look to see if either contains cast or a ptr_as_array deref. If
* it does we don't know how to safely make any inferences. Hopefully,
* nir_opt_deref will clean most of these up and we can start inferring
* things again.
*
@ -527,11 +527,13 @@ nir_compare_deref_paths(nir_deref_path *a_path,
* different constant indices.
*/
for (nir_deref_instr **t_p = a_p; *t_p; t_p++) {
if ((*t_p)->deref_type == nir_deref_type_ptr_as_array)
if ((*t_p)->deref_type == nir_deref_type_cast ||
(*t_p)->deref_type == nir_deref_type_ptr_as_array)
return nir_derefs_may_alias_bit;
}
for (nir_deref_instr **t_p = b_p; *t_p; t_p++) {
if ((*t_p)->deref_type == nir_deref_type_ptr_as_array)
if ((*t_p)->deref_type == nir_deref_type_cast ||
(*t_p)->deref_type == nir_deref_type_ptr_as_array)
return nir_derefs_may_alias_bit;
}