mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 14:50:11 +01:00
nir: Use remove_and_dce for nir_shader_lower_instructions().
Reduces the work that other shader passes have to do to look at dead code, and possibly extra rounds around the optimization loop if dce wasn't the last pass in it. shader-db runtime -1.12919% +/- 0.264337% (n=49) on SKL. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11628>
This commit is contained in:
parent
5251548572
commit
5618445d45
2 changed files with 6 additions and 2 deletions
|
|
@ -2003,7 +2003,7 @@ nir_function_impl_lower_instructions(nir_function_impl *impl,
|
|||
nir_if_rewrite_condition(use_src->parent_if, new_src);
|
||||
|
||||
if (nir_ssa_def_is_unused(old_def)) {
|
||||
iter = nir_instr_remove(instr);
|
||||
iter = nir_instr_remove_and_dce(instr);
|
||||
} else {
|
||||
iter = nir_after_instr(instr);
|
||||
}
|
||||
|
|
@ -2017,7 +2017,7 @@ nir_function_impl_lower_instructions(nir_function_impl *impl,
|
|||
if (new_def == NIR_LOWER_INSTR_PROGRESS_REPLACE) {
|
||||
/* Only instructions without a return value can be removed like this */
|
||||
assert(!old_def);
|
||||
iter = nir_instr_remove(instr);
|
||||
iter = nir_instr_remove_and_dce(instr);
|
||||
progress = true;
|
||||
} else
|
||||
iter = nir_after_instr(instr);
|
||||
|
|
|
|||
|
|
@ -4314,6 +4314,10 @@ typedef nir_ssa_def *(*nir_lower_instr_cb)(struct nir_builder *,
|
|||
* will be removed. If new instructions are added, the lowering callback will
|
||||
* also be called on them in case multiple lowerings are required.
|
||||
*
|
||||
* If the callback indicates that the original instruction is replaced (either
|
||||
* through a new SSA def or NIR_LOWER_INSTR_PROGRESS_REPLACE), then the
|
||||
* instruction is removed along with any now-dead SSA defs it used.
|
||||
*
|
||||
* The metadata for the nir_function_impl will also be updated. If any blocks
|
||||
* are added (they cannot be removed), dominance and block indices will be
|
||||
* invalidated.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue