summaryrefslogtreecommitdiff
path: root/lib/mesa/src/compiler/nir/nir_deref.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src/compiler/nir/nir_deref.c')
-rw-r--r--lib/mesa/src/compiler/nir/nir_deref.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/mesa/src/compiler/nir/nir_deref.c b/lib/mesa/src/compiler/nir/nir_deref.c
index 4a2e81956..895e542f9 100644
--- a/lib/mesa/src/compiler/nir/nir_deref.c
+++ b/lib/mesa/src/compiler/nir/nir_deref.c
@@ -490,10 +490,9 @@ nir_rematerialize_derefs_in_use_blocks_impl(nir_function_impl *impl)
_mesa_hash_table_clear(state.cache, NULL);
nir_foreach_instr_safe(instr, block) {
- if (instr->type == nir_instr_type_deref) {
- nir_deref_instr_remove_if_unused(nir_instr_as_deref(instr));
+ if (instr->type == nir_instr_type_deref &&
+ nir_deref_instr_remove_if_unused(nir_instr_as_deref(instr)))
continue;
- }
state.builder.cursor = nir_before_instr(instr);
nir_foreach_src(instr, rematerialize_deref_src, &state);