aco: Fix accidental copies, attempt two
Use auto to avoid mistyping the constness of the pair key, which
triggers implicit conversions rather than compilation errors.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7346>
diff --git a/src/amd/compiler/aco_insert_waitcnt.cpp b/src/amd/compiler/aco_insert_waitcnt.cpp
index bc34076..54c2d87 100644
--- a/src/amd/compiler/aco_insert_waitcnt.cpp
+++ b/src/amd/compiler/aco_insert_waitcnt.cpp
@@ -313,7 +313,7 @@
pending_flat_vm |= other->pending_flat_vm;
pending_s_buffer_store |= other->pending_s_buffer_store;
- for (const std::pair<PhysReg,wait_entry>& entry : other->gpr_map)
+ for (const auto& entry : other->gpr_map)
{
if (entry.second.logical != logical)
continue;
@@ -335,7 +335,7 @@
/* these are used for statistics, so don't update "changed" */
for (unsigned i = 0; i < num_counters; i++) {
- for (const std::pair<Instruction *, unsigned>& instr : other->unwaited_instrs[i]) {
+ for (const auto& instr : other->unwaited_instrs[i]) {
using iterator = std::map<Instruction *, unsigned>::iterator;
const std::pair<iterator, bool> insert_pair = unwaited_instrs[i].insert(instr);
if (!insert_pair.second) {
@@ -343,8 +343,11 @@
pos->second = std::min(pos->second, instr.second);
}
}
- for (const std::pair<PhysReg,std::set<Instruction *>>& 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<Instruction *>& instrs = instr_pair.second;
+ reg_instrs[i][reg].insert(instrs.begin(), instrs.end());
+ }
}
return changed;