nir/dominance: don't allocate 0-sized dom_children

86% of all ralloc calls for dom_children in Unigine Heaven + Superposition
had size == 0. It was only allocating the ralloc header.

It was 6.1% of all ralloc calls with the gallium noop driver.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
This commit is contained in:
Marek Olšák
2025-08-09 02:30:24 -04:00
committed by Marge Bot
parent 61c58fa0af
commit aeed2cc19d

View File

@@ -135,6 +135,10 @@ calc_dom_children(nir_function_impl *impl)
}
nir_foreach_block_unstructured(block, impl) {
if (!block->num_dom_children) {
block->dom_children = NULL;
continue;
}
block->dom_children = ralloc_array(mem_ctx, nir_block *,
block->num_dom_children);
block->num_dom_children = 0;