nir/find_array_copies: Prepare for generic pointers

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:48:49 -06:00 committed by Marge Bot
parent ced9b6f0d8
commit d50a4dbc13

View file

@ -553,9 +553,19 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,
* continue on because it won't affect local stores or read-only
* variables.
*/
if (dst_deref->mode != nir_var_function_temp)
if (!nir_deref_mode_may_be(dst_deref, nir_var_function_temp))
continue;
if (!nir_deref_mode_must_be(dst_deref, nir_var_function_temp)) {
/* This only happens if we have something that might be a local store
* but we don't know. In this case, clear everything.
*/
nir_deref_path dst_path;
nir_deref_path_init(&dst_path, dst_deref, state->dead_ctx);
foreach_aliasing_node(&dst_path, clobber, state);
continue;
}
/* If there are any known out-of-bounds writes, then we can just skip
* this write as it's undefined and won't contribute to building up an
* array copy anyways.
@ -588,8 +598,8 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,
* read-only.
*/
if (src_deref &&
!(src_deref->mode & (nir_var_function_temp |
nir_var_read_only_modes))) {
!nir_deref_mode_must_be(src_deref, nir_var_function_temp |
nir_var_read_only_modes)) {
src_deref = NULL;
}