From bfc570ff9864601e52386c947dd57c260cd02860 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Tue, 21 Jan 2025 15:49:35 +0000 Subject: [PATCH] nir/gcm: stop preserving nir_metadata_loop_analysis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This pass changes instr_cost if it makes progress. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/compiler/nir/nir_opt_gcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c index 0654f4d95b5..9d424b2faa2 100644 --- a/src/compiler/nir/nir_opt_gcm.c +++ b/src/compiler/nir/nir_opt_gcm.c @@ -857,8 +857,12 @@ opt_gcm_impl(nir_shader *shader, nir_function_impl *impl, bool value_number) ralloc_free(state.blocks); ralloc_free(state.instr_infos); - nir_metadata_preserve(impl, nir_metadata_control_flow | - nir_metadata_loop_analysis); + if (state.progress) { + nir_metadata_preserve(impl, nir_metadata_control_flow); + } else { + nir_metadata_preserve(impl, nir_metadata_control_flow | + nir_metadata_loop_analysis); + } return state.progress; }