summaryrefslogtreecommitdiff
path: root/src/amd/compiler/aco_spill.cpp
diff options
context:
space:
mode:
authorTony Wasserka <tony.wasserka@gmx.de>2021-07-10 13:59:42 +0200
committerMarge Bot <eric+marge@anholt.net>2021-10-01 09:39:13 +0000
commit387b315ea047779db4a0657c1280bc3bd5531eaa (patch)
tree23f1a046417e59389c90f6a25d85a239542193cb /src/amd/compiler/aco_spill.cpp
parent276da301e6803023560164679c48fc0e07f2b8d2 (diff)
downloadmesa-387b315ea047779db4a0657c1280bc3bd5531eaa.tar.gz
aco/spill: Avoid copying next_use maps more often than needed
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>
Diffstat (limited to 'src/amd/compiler/aco_spill.cpp')
-rw-r--r--src/amd/compiler/aco_spill.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp
index 646b492fbc9..fcb0eafbb2b 100644
--- a/src/amd/compiler/aco_spill.cpp
+++ b/src/amd/compiler/aco_spill.cpp
@@ -359,10 +359,11 @@ local_next_uses(spill_ctx& ctx, Block* block)
{
std::vector<std::map<Temp, uint32_t>> local_next_uses(block->instructions.size());
- std::map<Temp, uint32_t> next_uses;
for (std::pair<const Temp, std::pair<uint32_t, uint32_t>>& pair :
- ctx.next_use_distances_end[block->index])
- next_uses.insert({pair.first, pair.second.second + block->instructions.size()});
+ ctx.next_use_distances_end[block->index]) {
+ local_next_uses[block->instructions.size() - 1].insert(
+ {pair.first, pair.second.second + block->instructions.size()});
+ }
for (int idx = block->instructions.size() - 1; idx >= 0; idx--) {
aco_ptr<Instruction>& instr = block->instructions[idx];
@@ -371,19 +372,24 @@ local_next_uses(spill_ctx& ctx, Block* block)
if (instr->opcode == aco_opcode::p_phi || instr->opcode == aco_opcode::p_linear_phi)
break;
+ if (idx != (int)block->instructions.size() - 1) {
+ local_next_uses[idx] = local_next_uses[idx + 1];
+ }
+
for (const Operand& op : instr->operands) {
if (op.isFixed() && op.physReg() == exec)
continue;
if (op.regClass().type() == RegType::vgpr && op.regClass().is_linear())
continue;
- if (op.isTemp())
- next_uses[op.getTemp()] = idx;
+ if (op.isTemp()) {
+ local_next_uses[idx][op.getTemp()] = idx;
+ }
}
for (const Definition& def : instr->definitions) {
- if (def.isTemp())
- next_uses.erase(def.getTemp());
+ if (def.isTemp()) {
+ local_next_uses[idx].erase(def.getTemp());
+ }
}
- local_next_uses[idx] = next_uses;
}
return local_next_uses;
}