summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-12-13 16:30:24 -0600
committerJason Ekstrand <[email protected]>2018-12-18 13:13:28 -0600
commit5dad1abfdcfc772c63e7c883ab34ae1ad39461f3 (patch)
tree58923ac7792aa571851d186c9029925b857c6114
parentfa40a58fd9c0faeead561fd1dbaaaefc6eb61633 (diff)
nir/dead_write_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 clear_unused_for_modes for derefs that don't have an accessible variable. Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/compiler/nir/nir_opt_dead_write_vars.c3
1 files changed, 1 insertions, 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 dd949998cc8..75814738d84 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);
}
}