aco: pass vars by const &
authorAlbert Astals Cid <aacid@kde.org>
Mon, 24 Feb 2020 23:49:01 +0000 (00:49 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 2 Mar 2020 13:18:49 +0000 (13:18 +0000)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3935>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3935>

src/amd/compiler/aco_register_allocation.cpp

index d43806e9badcb8f1ee22ac7941ea7c0af290f868..e8b1069a50997cb480eddb63be2609892581df18 100644 (file)
@@ -313,7 +313,7 @@ std::pair<PhysReg, bool> get_reg_simple(ra_ctx& ctx,
 bool get_regs_for_copies(ra_ctx& ctx,
                          RegisterFile& reg_file,
                          std::vector<std::pair<Operand, Definition>>& parallelcopies,
-                         std::set<std::pair<unsigned, unsigned>> vars,
+                         const std::set<std::pair<unsigned, unsigned>> &vars,
                          uint32_t lb, uint32_t ub,
                          aco_ptr<Instruction>& instr,
                          uint32_t def_reg_lo,
@@ -322,7 +322,7 @@ bool get_regs_for_copies(ra_ctx& ctx,
 
    /* variables are sorted from small sized to large */
    /* NOTE: variables are also sorted by ID. this only affects a very small number of shaders slightly though. */
-   for (std::set<std::pair<unsigned, unsigned>>::reverse_iterator it = vars.rbegin(); it != vars.rend(); ++it) {
+   for (std::set<std::pair<unsigned, unsigned>>::const_reverse_iterator it = vars.rbegin(); it != vars.rend(); ++it) {
       unsigned id = it->second;
       std::pair<PhysReg, RegClass> var = ctx.assignments[id];
       uint32_t size = it->first;