From f10d4bf963a4ba7ac5caafa809281b31bed13b9f Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 18 Aug 2021 14:19:32 +0100 Subject: [PATCH] nir: call nir_metadata_preserve in nir_io_add_const_offset_to_base This is necessary to use this pass with the NIR_PASS() macro. Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Part-of: --- src/compiler/nir/nir_lower_io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index d7aaad6af8c..5e3b866ff20 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -2827,11 +2827,17 @@ nir_io_add_const_offset_to_base(nir_shader *nir, nir_variable_mode modes) nir_foreach_function(f, nir) { if (f->impl) { + bool impl_progress = false; nir_builder b; nir_builder_init(&b, f->impl); nir_foreach_block(block, f->impl) { - progress |= add_const_offset_to_base_block(block, &b, modes); + impl_progress |= add_const_offset_to_base_block(block, &b, modes); } + progress |= impl_progress; + if (impl_progress) + nir_metadata_preserve(f->impl, nir_metadata_block_index | nir_metadata_dominance); + else + nir_metadata_preserve(f->impl, nir_metadata_all); } }