This pass rarely makes any changes, so work a little harder to preserve
more meta data.
On my Ice Lake laptop (using a locked CPU speed and other measures to
prevent thermal throttling, etc.) using a debugoptimized build, improves
performance of Vulkan CTS "deqp-vk --deqp-case='dEQP-VK.*spir*'" by
-0.2% ± 0.1% (n = 5, pooled s = 0.431885).
v2: Add some parenthesis. Suggested by Lionel.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22299>
nir_block *top = nir_start_block(f->impl);
nir_cursor cursor = nir_before_instr(nir_block_first_instr(top));
+ bool impl_progress = false;
for (nir_block *block = nir_block_cf_tree_next(top);
block != NULL;
for (unsigned i = 0; i < ARRAY_SIZE(move); i++) {
if (move[i]->block != top) {
nir_instr_move(cursor, move[i]);
- progress = true;
+ impl_progress = true;
}
}
}
}
- nir_metadata_preserve(f->impl, nir_metadata_block_index |
- nir_metadata_dominance);
+
+ progress = progress || impl_progress;
+
+ nir_metadata_preserve(f->impl, impl_progress ? (nir_metadata_block_index |
+ nir_metadata_dominance)
+ : nir_metadata_all);
}
return progress;