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>
This commit is contained in:
Marcin Ślusarz 2021-08-06 12:14:38 +02:00 committed by Marge Bot
parent a57bcc4394
commit e1b325f587

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