diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index 9367db9e160..35a532dea72 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -29,12 +29,25 @@ #include "common/sid.h" #include +#include #include #include #include +#include #include #include +namespace std { +template <> struct hash { + size_t operator()(aco::Temp temp) const noexcept + { + uint32_t v; + std::memcpy(&v, &temp, sizeof(temp)); + return std::hash{}(v); + } +}; +} // namespace std + /* * Implements the spilling algorithm on SSA-form from * "Register Spilling and Live-Range Splitting for SSA-Form Programs" @@ -59,8 +72,8 @@ struct spill_ctx { std::vector processed; std::stack> loop_header; - std::vector>> next_use_distances_start; - std::vector>> next_use_distances_end; + std::vector>> next_use_distances_start; + std::vector>> next_use_distances_end; std::vector>> local_next_use_distance; /* Working buffer */ std::vector>> interferences; std::vector> affinities; @@ -158,11 +171,12 @@ void next_uses_per_block(spill_ctx& ctx, unsigned block_idx, std::set& worklist) { Block* block = &ctx.program->blocks[block_idx]; - std::map> next_uses = ctx.next_use_distances_end[block_idx]; + std::unordered_map> next_uses = + ctx.next_use_distances_end[block_idx]; /* to compute the next use distance at the beginning of the block, we have to add the block's * size */ - for (std::map>::iterator it = next_uses.begin(); + for (std::unordered_map>::iterator it = next_uses.begin(); it != next_uses.end(); ++it) it->second.second = it->second.second + block->instructions.size();