diff options
author | Jason Ekstrand <[email protected]> | 2018-11-28 17:27:57 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-01-08 00:38:30 +0000 |
commit | 7e85480a67eea965481266bf4bcdb690b44e19bd (patch) | |
tree | bdc4b826f7b4807e2f43fb691dbfbc4002f5ab3d | |
parent | 78d80f7db2fab78b1af96d5acf216d71448d7972 (diff) |
nir/remove_dead_variables: Properly handle deref casts
We already detect any incomplete deref chains (where the deref is used
for something other than another deref or a load/store) and flag the
variable as used thanks to deref_used_for_not_store. All that's left to
do is to properly skip casts when cleaning up.
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
-rw-r--r-- | src/compiler/nir/nir_remove_dead_variables.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c index fadc51a6977..5e972491a1c 100644 --- a/src/compiler/nir/nir_remove_dead_variables.c +++ b/src/compiler/nir/nir_remove_dead_variables.c @@ -103,6 +103,9 @@ remove_dead_var_writes(nir_shader *shader, struct set *live) switch (instr->type) { case nir_instr_type_deref: { nir_deref_instr *deref = nir_instr_as_deref(instr); + if (deref->deref_type == nir_deref_type_cast && + !nir_deref_instr_parent(deref)) + continue; nir_variable_mode parent_mode; if (deref->deref_type == nir_deref_type_var) |