From: Jason Ekstrand Date: Thu, 13 Dec 2018 22:28:23 +0000 (-0600) Subject: nir/copy_prop_vars: Get modes directly from derefs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa40a58fd9c0faeead561fd1dbaaaefc6eb61633;p=mesa.git nir/copy_prop_vars: Get modes directly from derefs Instead of going all the way back to the variable, just look at the deref. The modes are guaranteed to be the same by nir_validate whenever the variable can be found. This fixes apply_barrier_for_modes for derefs that don't have an accessible variable. Reviewed-by: Timothy Arceri --- diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c index 48070cd5e31..a540e01529c 100644 --- a/src/compiler/nir/nir_opt_copy_prop_vars.c +++ b/src/compiler/nir/nir_opt_copy_prop_vars.c @@ -337,12 +337,8 @@ apply_barrier_for_modes(struct util_dynarray *copies, nir_variable_mode modes) { util_dynarray_foreach_reverse(copies, struct copy_entry, iter) { - nir_variable *dst_var = nir_deref_instr_get_variable(iter->dst); - nir_variable *src_var = iter->src.is_ssa ? NULL : - nir_deref_instr_get_variable(iter->src.deref); - - if ((dst_var->data.mode & modes) || - (src_var && (src_var->data.mode & modes))) + if ((iter->dst->mode & modes) || + (!iter->src.is_ssa && (iter->src.deref->mode & modes))) copy_entry_remove(copies, iter); } }