Series:

Reviewed-by: Timothy Arceri <[email protected]>

On 18/12/18 3:44 pm, Jason Ekstrand wrote:
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 clear_unused_for_modes for
derefs that don't have an accessible variable.
---
  src/compiler/nir/nir_opt_dead_write_vars.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_opt_dead_write_vars.c 
b/src/compiler/nir/nir_opt_dead_write_vars.c
index d43bf5c1193..2ae5f78b791 100644
--- a/src/compiler/nir/nir_opt_dead_write_vars.c
+++ b/src/compiler/nir/nir_opt_dead_write_vars.c
@@ -56,8 +56,7 @@ static void
  clear_unused_for_modes(struct util_dynarray *unused_writes, nir_variable_mode 
modes)
  {
     util_dynarray_foreach_reverse(unused_writes, struct write_entry, entry) {
-      nir_variable *var = nir_deref_instr_get_variable(entry->dst);
-      if (var->data.mode & modes)
+      if (entry->dst->mode & modes)
           *entry = util_dynarray_pop(unused_writes, struct write_entry);
     }
  }

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to