diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 74376b1df9f..824042b3303 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -1091,6 +1091,11 @@ void nir_instr_remove_v(nir_instr *instr) } } +void nir_instr_free(nir_instr *instr) +{ + ralloc_free(instr); +} + static bool nir_instr_free_and_dce_live_cb(nir_ssa_def *def, void *state) { bool *live = state; @@ -1177,7 +1182,7 @@ nir_instr_free_and_dce(nir_instr *instr) struct exec_node *node; while ((node = exec_list_pop_head(&to_free))) { nir_instr *removed_instr = exec_node_data(nir_instr, node, node); - ralloc_free(removed_instr); + nir_instr_free(removed_instr); } nir_instr_worklist_destroy(worklist); diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 33cc82e9d93..392fad34e6b 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4225,6 +4225,7 @@ nir_instr_insert_after_cf_list(struct exec_list *list, nir_instr *after) } void nir_instr_remove_v(nir_instr *instr); +void nir_instr_free(nir_instr *instr); static inline nir_cursor nir_instr_remove(nir_instr *instr) diff --git a/src/compiler/nir/nir_lower_var_copies.c b/src/compiler/nir/nir_lower_var_copies.c index f9df4446a14..8a748982431 100644 --- a/src/compiler/nir/nir_lower_var_copies.c +++ b/src/compiler/nir/nir_lower_var_copies.c @@ -142,7 +142,7 @@ lower_var_copies_impl(nir_function_impl *impl) nir_deref_instr_remove_if_unused(nir_src_as_deref(copy->src[1])); progress = true; - ralloc_free(copy); + nir_instr_free(©->instr); } } diff --git a/src/compiler/nir/nir_lower_vec_to_movs.c b/src/compiler/nir/nir_lower_vec_to_movs.c index bcad081b115..afebc136452 100644 --- a/src/compiler/nir/nir_lower_vec_to_movs.c +++ b/src/compiler/nir/nir_lower_vec_to_movs.c @@ -107,7 +107,7 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) if (mov->dest.write_mask) { nir_instr_insert_before(&vec->instr, &mov->instr); } else { - ralloc_free(mov); + nir_instr_free(&mov->instr); } return channels_handled; @@ -296,7 +296,7 @@ nir_lower_vec_to_movs_instr(nir_builder *b, nir_instr *instr, void *data) } nir_instr_remove(&vec->instr); - ralloc_free(vec); + nir_instr_free(&vec->instr); return true; } diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c index 5695a09e2e4..b46239794cc 100644 --- a/src/compiler/nir/nir_opt_constant_folding.c +++ b/src/compiler/nir/nir_opt_constant_folding.c @@ -105,8 +105,7 @@ try_fold_alu(nir_builder *b, nir_alu_instr *alu) dest); nir_ssa_def_rewrite_uses(&alu->dest.dest.ssa, imm); nir_instr_remove(&alu->instr); - - ralloc_free(alu); + nir_instr_free(&alu->instr); return true; } diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c index 20a72d647bf..b6c69bfd163 100644 --- a/src/compiler/nir/nir_opt_if.c +++ b/src/compiler/nir/nir_opt_if.c @@ -540,7 +540,7 @@ opt_split_alu_of_phi(nir_builder *b, nir_loop *loop) * remove it. */ nir_instr_remove_v(&alu->instr); - ralloc_free(alu); + nir_instr_free(&alu->instr); progress = true; } @@ -705,7 +705,7 @@ opt_simplify_bcsel_of_phi(nir_builder *b, nir_loop *loop) * just remove it. */ nir_instr_remove_v(&bcsel->instr); - ralloc_free(bcsel); + nir_instr_free(&bcsel->instr); progress = true; }