From e1b325f58730d8fd82829c538c9e83aa193c4eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= Date: Fri, 6 Aug 2021 12:14:38 +0200 Subject: [PATCH] nir/builder: invalidate metadata per function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: a62098fff20 ("nir: Add a helper for general instruction-modifying passes.") Signed-off-by: Marcin Ĺšlusarz Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_builder.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index e778f0e73c8..b1def3e996c 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -103,17 +103,19 @@ nir_shader_instructions_pass(nir_shader *shader, if (!function->impl) continue; + bool func_progress = false; nir_builder b; nir_builder_init(&b, function->impl); nir_foreach_block_safe(block, function->impl) { nir_foreach_instr_safe(instr, block) { - progress |= pass(&b, instr, cb_data); + func_progress |= pass(&b, instr, cb_data); } } - if (progress) { + if (func_progress) { nir_metadata_preserve(function->impl, preserved); + progress = true; } else { nir_metadata_preserve(function->impl, nir_metadata_all); }