From 97850c0bf0b878f38b33a09cb5ad61172946245b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 22 Aug 2022 17:26:34 +0200 Subject: [PATCH] aco/opt_value_numbering: use monotonic_allocator for unordered_map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch also changes the rename map to unordered. Roughly halves the time spent on CSE in ACO. Reviewed-by: Timur Kristóf Part-of: --- src/amd/compiler/aco_opt_value_numbering.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/amd/compiler/aco_opt_value_numbering.cpp b/src/amd/compiler/aco_opt_value_numbering.cpp index e1541446668..8b2fa3591ef 100644 --- a/src/amd/compiler/aco_opt_value_numbering.cpp +++ b/src/amd/compiler/aco_opt_value_numbering.cpp @@ -23,8 +23,8 @@ */ #include "aco_ir.h" +#include "aco_util.h" -#include #include #include @@ -297,12 +297,13 @@ struct InstrPred { } }; -using expr_set = std::unordered_map; +using expr_set = aco::unordered_map; struct vn_ctx { Program* program; + monotonic_buffer_resource m; expr_set expr_values; - std::map renames; + aco::unordered_map renames; /* The exec id should be the same on the same level of control flow depth. * Together with the check for dominator relations, it is safe to assume @@ -311,7 +312,7 @@ struct vn_ctx { */ uint32_t exec_id = 1; - vn_ctx(Program* program_) : program(program_) + vn_ctx(Program* program_) : program(program_), m(), expr_values(m), renames(m) { static_assert(sizeof(Temp) == 4, "Temp must fit in 32bits"); unsigned size = 0; @@ -446,7 +447,7 @@ process_block(vn_ctx& ctx, Block& block) } void -rename_phi_operands(Block& block, std::map& renames) +rename_phi_operands(Block& block, aco::unordered_map& renames) { for (aco_ptr& phi : block.instructions) { if (phi->opcode != aco_opcode::p_phi && phi->opcode != aco_opcode::p_linear_phi)