From d48d72e98af9436babeeb3a94b312f94bc582b36 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 30 Oct 2019 12:00:23 +0100 Subject: [PATCH] aco: don't insert the exec mask into set of live-out variables when spilling Reviewed-by: Rhys Perry --- src/amd/compiler/aco_spill.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index b7f4fd1992c..1668360eac0 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -137,16 +137,9 @@ void next_uses_per_block(spill_ctx& ctx, unsigned block_idx, std::set& std::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(); it != next_uses.end();) { + for (std::map>::iterator it = next_uses.begin(); it != next_uses.end(); ++it) it->second.second = it->second.second + block->instructions.size(); - /* remove the live out exec mask as we really don't want to spill it */ - if (it->first == block->live_out_exec) - it = next_uses.erase(it); - else - ++it; - } - int idx = block->instructions.size() - 1; while (idx >= 0) { aco_ptr& instr = block->instructions[idx]; @@ -181,6 +174,8 @@ void next_uses_per_block(spill_ctx& ctx, unsigned block_idx, std::set& block->logical_preds[i] : block->linear_preds[i]; if (instr->operands[i].isTemp()) { + if (instr->operands[i].getTemp() == ctx.program->blocks[pred_idx].live_out_exec) + continue; if (ctx.next_use_distances_end[pred_idx].find(instr->operands[i].getTemp()) == ctx.next_use_distances_end[pred_idx].end() || ctx.next_use_distances_end[pred_idx][instr->operands[i].getTemp()] != std::pair{block_idx, 0}) worklist.insert(pred_idx); @@ -198,6 +193,8 @@ void next_uses_per_block(spill_ctx& ctx, unsigned block_idx, std::set& uint32_t dom = pair.second.first; std::vector& preds = temp.is_linear() ? block->linear_preds : block->logical_preds; for (unsigned pred_idx : preds) { + if (temp == ctx.program->blocks[pred_idx].live_out_exec) + continue; if (ctx.program->blocks[pred_idx].loop_nest_depth > block->loop_nest_depth) distance += 0xFFFF; if (ctx.next_use_distances_end[pred_idx].find(temp) != ctx.next_use_distances_end[pred_idx].end()) { @@ -312,13 +309,8 @@ std::vector> local_next_uses(spill_ctx& ctx, Block* blo std::vector> local_next_uses(block->instructions.size()); std::map next_uses; - for (std::pair> pair : ctx.next_use_distances_end[block->index]) { - /* omit live out exec mask */ - if (pair.first == block->live_out_exec) - continue; - + for (std::pair> pair : ctx.next_use_distances_end[block->index]) next_uses[pair.first] = pair.second.second + block->instructions.size(); - } for (int idx = block->instructions.size() - 1; idx >= 0; idx--) { aco_ptr& instr = block->instructions[idx]; -- 2.30.2