nir/builder: invalidate metadata per function

Fixes: a62098fff2 ("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 e1b325f587)
This commit is contained in:
Marcin Ślusarz 2021-08-06 12:14:38 +02:00 committed by Eric Engestrom
parent c63793dc47
commit 7e847fa52f
2 changed files with 5 additions and 3 deletions

View File

@ -3721,7 +3721,7 @@
"description": "nir/builder: invalidate metadata per function",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "a62098fff202f5e6c689aa6e78ace67c50f17c8e"
},

View File

@ -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);
}