diff --git a/src/amd/compiler/aco_reindex_ssa.cpp b/src/amd/compiler/aco_reindex_ssa.cpp index 03c0c5b79a2..0da38057423 100644 --- a/src/amd/compiler/aco_reindex_ssa.cpp +++ b/src/amd/compiler/aco_reindex_ssa.cpp @@ -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); } } diff --git a/src/amd/compiler/aco_util.h b/src/amd/compiler/aco_util.h index 3bc3050d9d3..ad4b697442f 100644 --- a/src/amd/compiler/aco_util.h +++ b/src/amd/compiler/aco_util.h @@ -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;