aco/spill: Avoid destroying local next use maps over-eagerly

Recreating these maps in a later block requires allocating fresh memory.
Instead, by never shrinking the containing vector in the first place,
previously allocated map memory is now re-used.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>
This commit is contained in:
Tony Wasserka 2021-07-19 19:43:54 +02:00 committed by Marge Bot
parent df6c395095
commit 92d7a6ab1c
1 changed files with 5 additions and 1 deletions

View File

@ -360,7 +360,11 @@ void
update_local_next_uses(spill_ctx& ctx, Block* block,
std::vector<std::map<Temp, uint32_t>>& local_next_uses)
{
local_next_uses.resize(block->instructions.size());
if (local_next_uses.size() < block->instructions.size()) {
/* Allocate more next-use-maps. Note that by never reducing the vector size, we enable
* future calls to this function to re-use already allocated map memory. */
local_next_uses.resize(block->instructions.size());
}
local_next_uses[block->instructions.size() - 1].clear();
for (std::pair<const Temp, std::pair<uint32_t, uint32_t>>& pair :