From 6d058ac6c997efe05bca13ba3f381b4d55a13e40 Mon Sep 17 00:00:00 2001 From: James Park Date: Thu, 29 Oct 2020 11:03:07 -0700 Subject: [PATCH] aco: Fix accidental copies, attempt two MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use auto to avoid mistyping the constness of the pair key, which triggers implicit conversions rather than compilation errors. Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_insert_waitcnt.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/amd/compiler/aco_insert_waitcnt.cpp b/src/amd/compiler/aco_insert_waitcnt.cpp index bc340764dd1..54c2d87bf45 100644 --- a/src/amd/compiler/aco_insert_waitcnt.cpp +++ b/src/amd/compiler/aco_insert_waitcnt.cpp @@ -313,7 +313,7 @@ struct wait_ctx { pending_flat_vm |= other->pending_flat_vm; pending_s_buffer_store |= other->pending_s_buffer_store; - for (const std::pair& entry : other->gpr_map) + for (const auto& entry : other->gpr_map) { if (entry.second.logical != logical) continue; @@ -335,7 +335,7 @@ struct wait_ctx { /* these are used for statistics, so don't update "changed" */ for (unsigned i = 0; i < num_counters; i++) { - for (const std::pair& instr : other->unwaited_instrs[i]) { + for (const auto& instr : other->unwaited_instrs[i]) { using iterator = std::map::iterator; const std::pair insert_pair = unwaited_instrs[i].insert(instr); if (!insert_pair.second) { @@ -343,8 +343,11 @@ struct wait_ctx { pos->second = std::min(pos->second, instr.second); } } - for (const std::pair>& instr : other->reg_instrs[i]) - reg_instrs[i][instr.first].insert(instr.second.begin(), instr.second.end()); + for (const auto& instr_pair : other->reg_instrs[i]) { + const PhysReg reg = instr_pair.first; + const std::set& instrs = instr_pair.second; + reg_instrs[i][reg].insert(instrs.begin(), instrs.end()); + } } return changed;