diff options
author | Rhys Perry <[email protected]> | 2020-01-02 14:57:02 +0000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-29 18:02:27 +0000 |
commit | 4537b9741014fbd40b9ed5d98a658031997851aa (patch) | |
tree | bd036a47364fedefdef46e4675792a1955ca3c5e | |
parent | 521525fc0a3b9008e70841542ad6e3db4b1ea4d6 (diff) |
aco: don't update demand in add_coupling_code() for loop headers
We don't need to update it since it won't be used later.
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Daniel Schürmann <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3257>
-rw-r--r-- | src/amd/compiler/aco_spill.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index 576b8e02aea..4179a775388 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -989,8 +989,11 @@ void add_coupling_code(spill_ctx& ctx, Block* block, unsigned block_idx) idx++; } - ctx.register_demand[block->index].erase(ctx.register_demand[block->index].begin(), ctx.register_demand[block->index].begin() + idx); - ctx.register_demand[block->index].insert(ctx.register_demand[block->index].begin(), instructions.size(), RegisterDemand()); + if (!ctx.processed[block_idx]) { + assert(!(block->kind & block_kind_loop_header)); + ctx.register_demand[block->index].erase(ctx.register_demand[block->index].begin(), ctx.register_demand[block->index].begin() + idx); + ctx.register_demand[block->index].insert(ctx.register_demand[block->index].begin(), instructions.size(), RegisterDemand()); + } std::vector<aco_ptr<Instruction>>::iterator start = std::next(block->instructions.begin(), idx); instructions.insert(instructions.end(), std::move_iterator<std::vector<aco_ptr<Instruction>>::iterator>(start), @@ -1001,6 +1004,8 @@ void add_coupling_code(spill_ctx& ctx, Block* block, unsigned block_idx) void process_block(spill_ctx& ctx, unsigned block_idx, Block* block, std::map<Temp, uint32_t> ¤t_spills, RegisterDemand spilled_registers) { + assert(!ctx.processed[block_idx]); + std::vector<std::map<Temp, uint32_t>> local_next_use_distance; std::vector<aco_ptr<Instruction>> instructions; unsigned idx = 0; @@ -1145,7 +1150,6 @@ void process_block(spill_ctx& ctx, unsigned block_idx, Block* block, void spill_block(spill_ctx& ctx, unsigned block_idx) { Block* block = &ctx.program->blocks[block_idx]; - ctx.processed[block_idx] = true; /* determine set of variables which are spilled at the beginning of the block */ RegisterDemand spilled_registers = init_live_in_vars(ctx, block, block_idx); @@ -1182,6 +1186,8 @@ void spill_block(spill_ctx& ctx, unsigned block_idx) else ctx.spills_exit[block_idx].insert(current_spills.begin(), current_spills.end()); + ctx.processed[block_idx] = true; + /* check if the next block leaves the current loop */ if (block->loop_nest_depth == 0 || ctx.program->blocks[block_idx + 1].loop_nest_depth >= block->loop_nest_depth) return; |