From bcf16071a7bd2c61fc2ce337135fd354f398a8aa 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: (cherry picked from commit e1b325f58730d8fd82829c538c9e83aa193c4eba) --- .pick_status.json | 2 +- src/compiler/nir/nir_builder.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5148197a0de..4d4d7f59272 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -94,7 +94,7 @@ "description": "nir/builder: invalidate metadata per function", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a62098fff202f5e6c689aa6e78ace67c50f17c8e" }, diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 2551da45f9f..0beb2731eb6 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); }