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:
Emma Anholt
2021-06-28 10:51:06 -07:00
parent 5251548572
commit 5618445d45
2 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -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);