From c453921c91cb43a098b3e889bf0dfaf76b2bafce Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Wed, 10 Mar 2021 22:22:01 +0100 Subject: [PATCH] lima: run nir dce after nir_lower_vec_to_movs Some of the 'vec*' nir instructions may hold references to dead code until the nir_lower_vec_to_movs pass runs. After nir_lower_vec_to_movs, that code can finally be cleaned by dce, so add an additional dce pass. This not only potentially further removes unneeded code from the nir representation but also prevents bugs with the compiler from special case unused code that is not expected (e.g. root undef type nodes). Signed-off-by: Erico Nunes Reviewed-by: Vasily Khoruzhick Part-of: --- src/gallium/drivers/lima/lima_program.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/lima/lima_program.c b/src/gallium/drivers/lima/lima_program.c index 822ab79923b..8d154d1998e 100644 --- a/src/gallium/drivers/lima/lima_program.c +++ b/src/gallium/drivers/lima/lima_program.c @@ -261,6 +261,7 @@ lima_program_optimize_fs_nir(struct nir_shader *s, NIR_PASS_V(s, nir_move_vec_src_uses_to_dest); NIR_PASS_V(s, nir_lower_vec_to_movs, lima_vec_to_movs_filter_cb, NULL); + NIR_PASS_V(s, nir_opt_dce); /* clean up any new dead code from vec to movs */ NIR_PASS_V(s, lima_nir_duplicate_load_uniforms); NIR_PASS_V(s, lima_nir_duplicate_load_inputs);