Mesa (main): aco/spill: Use unordered_map for spills_exit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 09:57:12 UTC 2021


Module: Mesa
Branch: main
Commit: 3fad5efd1527f284f1e6cf307e260aebd187811c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3fad5efd1527f284f1e6cf307e260aebd187811c

Author: Tony Wasserka <tony.wasserka at gmx.de>
Date:   Fri Jul 16 12:17:29 2021 +0200

aco/spill: Use unordered_map for spills_exit

Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

---

 src/amd/compiler/aco_spill.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp
index 8e81eefab91..3ad8c0e8553 100644
--- a/src/amd/compiler/aco_spill.cpp
+++ b/src/amd/compiler/aco_spill.cpp
@@ -68,7 +68,7 @@ struct spill_ctx {
    std::vector<std::vector<RegisterDemand>> register_demand;
    std::vector<std::map<Temp, Temp>> renames;
    std::vector<std::map<Temp, uint32_t>> spills_entry;
-   std::vector<std::map<Temp, uint32_t>> spills_exit;
+   std::vector<std::unordered_map<Temp, uint32_t>> spills_exit;
 
    std::vector<bool> processed;
    std::stack<Block*, std::vector<Block*>> loop_header;
@@ -884,7 +884,7 @@ add_coupling_code(spill_ctx& ctx, Block* block, unsigned block_idx)
                ctx.unused_remats.erase(ctx.remat[var].instr);
 
             /* check if variable is already spilled at predecessor */
-            std::map<Temp, uint32_t>::iterator spilled = ctx.spills_exit[pred_idx].find(var);
+            auto spilled = ctx.spills_exit[pred_idx].find(var);
             if (spilled != ctx.spills_exit[pred_idx].end()) {
                if (spilled->second != def_spill_id)
                   ctx.add_affinity(def_spill_id, spilled->second);
@@ -934,7 +934,7 @@ add_coupling_code(spill_ctx& ctx, Block* block, unsigned block_idx)
 
       for (unsigned pred_idx : preds) {
          /* variable is already spilled at predecessor */
-         std::map<Temp, uint32_t>::iterator spilled = ctx.spills_exit[pred_idx].find(pair.first);
+         auto spilled = ctx.spills_exit[pred_idx].find(pair.first);
          if (spilled != ctx.spills_exit[pred_idx].end()) {
             if (spilled->second != pair.second)
                ctx.add_affinity(pair.second, spilled->second);
@@ -1306,7 +1306,7 @@ spill_block(spill_ctx& ctx, unsigned block_idx)
    }
 
    assert(ctx.spills_exit[block_idx].empty());
-   ctx.spills_exit[block_idx] = current_spills;
+   ctx.spills_exit[block_idx] = std::unordered_map<Temp, uint32_t>(current_spills.begin(), current_spills.end());
    if (process) {
       process_block(ctx, block_idx, block, spilled_registers);
    }



More information about the mesa-commit mailing list