aco/reindex_ssa: free memory of previous live variable sets

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30182>
This commit is contained in:
Daniel Schürmann
2024-07-04 11:45:36 +02:00
committed by Marge Bot
parent d776f3d3f9
commit c1a3330ac7
2 changed files with 14 additions and 1 deletions
+2 -1
View File
@@ -84,11 +84,12 @@ reindex_ssa(Program* program, bool update_live_out = false)
idx_ctx ctx;
reindex_program(ctx, program);
if (update_live_out) {
monotonic_buffer_resource old_memory = std::move(program->live.memory);
for (IDSet& set : program->live.live_in) {
IDSet new_set(program->live.memory);
for (uint32_t id : set)
new_set.insert(ctx.renames[id]);
set = new_set;
set = std::move(new_set);
}
}
+12
View File
@@ -247,6 +247,18 @@ public:
free(buffer);
}
/* Move-constructor and -assignment */
monotonic_buffer_resource(monotonic_buffer_resource&& other) : monotonic_buffer_resource()
{
*this = std::move(other);
}
monotonic_buffer_resource& operator=(monotonic_buffer_resource&& other)
{
release();
std::swap(buffer, other.buffer);
return *this;
}
/* Delete copy-constructor and -assignment to avoid double free() */
monotonic_buffer_resource(const monotonic_buffer_resource&) = delete;
monotonic_buffer_resource& operator=(const monotonic_buffer_resource&) = delete;