From 3f182bc1fab5365e3287c7bbecc962a02f705056 Mon Sep 17 00:00:00 2001 From: Natalie Vock Date: Tue, 18 Feb 2025 16:21:14 +0100 Subject: [PATCH] aco/ra: Use iterators for linear VGPR copy extraction Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 476877b97d1..0199373ba99 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -3064,18 +3064,18 @@ emit_parallel_copy(ra_ctx& ctx, std::vector>& par std::vector> linear_vgpr; if (ctx.num_linear_vgprs) { - unsigned next = 0; - for (unsigned i = 0; i < parallelcopy.size(); i++) { - if (parallelcopy[i].first.regClass().is_linear_vgpr()) { - linear_vgpr.push_back(parallelcopy[i]); + auto next = parallelcopy.begin(); + for (auto it = parallelcopy.begin(); it != parallelcopy.end(); ++it) { + if (it->first.regClass().is_linear_vgpr()) { + linear_vgpr.push_back(*it); continue; } - if (next != i) - parallelcopy[next] = parallelcopy[i]; - next++; + if (next != it) + *next = *it; + ++next; } - parallelcopy.resize(next); + parallelcopy.erase(next, parallelcopy.end()); } /* Because of how linear VGPRs are allocated, we should never have to move a linear VGPR into the