mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
nir/opt_dce: factor out dead instruction removal into a helper
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41166>
This commit is contained in:
parent
52669c3b5b
commit
7bd5856cc6
1 changed files with 9 additions and 4 deletions
|
|
@ -111,6 +111,13 @@ struct loop_state {
|
|||
nir_block *preheader;
|
||||
};
|
||||
|
||||
static void
|
||||
remove_instr(nir_instr *instr, struct exec_list *dead_instrs)
|
||||
{
|
||||
nir_instr_remove(instr);
|
||||
exec_list_push_tail(dead_instrs, &instr->node);
|
||||
}
|
||||
|
||||
static bool
|
||||
dce_block(nir_block *block, BITSET_WORD *defs_live, struct loop_state *loop,
|
||||
struct exec_list *dead_instrs)
|
||||
|
|
@ -136,8 +143,7 @@ dce_block(nir_block *block, BITSET_WORD *defs_live, struct loop_state *loop,
|
|||
if (loop->preheader) {
|
||||
instr->pass_flags = live;
|
||||
} else if (!live) {
|
||||
nir_instr_remove(instr);
|
||||
exec_list_push_tail(dead_instrs, &instr->node);
|
||||
remove_instr(instr, dead_instrs);
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -204,8 +210,7 @@ dce_cf_list(struct exec_list *cf_list, BITSET_WORD *defs_live,
|
|||
nir_foreach_block_in_cf_node(block, cf_node) {
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (!instr->pass_flags) {
|
||||
nir_instr_remove(instr);
|
||||
exec_list_push_tail(dead_instrs, &instr->node);
|
||||
remove_instr(instr, dead_instrs);
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue