diff options
author | Marcin Ślusarz <marcin.slusarz@intel.com> | 2021-08-06 12:14:38 +0200 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2021-08-12 10:06:57 -0700 |
commit | bcf16071a7bd2c61fc2ce337135fd354f398a8aa (patch) | |
tree | d6eed3327a436fd17c65e73cc3f679ac6db08168 | |
parent | 1e4967c1846f2d6eeb08697746d032f0a237f45d (diff) |
nir/builder: invalidate metadata per function
Fixes: a62098fff20 ("nir: Add a helper for general instruction-modifying passes.")
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12324>
(cherry picked from commit e1b325f58730d8fd82829c538c9e83aa193c4eba)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | 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); } |