diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c index 13aa10c7532..7b56611915d 100644 --- a/src/compiler/nir/nir_deref.c +++ b/src/compiler/nir/nir_deref.c @@ -574,10 +574,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);