aco/spill: add temporary operands of exec phis to next_use_distances_end

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: dfb10e4f4b ("aco/spill: don't count phis as variable access")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12702>
This commit is contained in:
Rhys Perry 2021-09-02 17:30:57 +01:00
parent f241bd3749
commit 54f83d718a
1 changed files with 7 additions and 7 deletions

View File

@ -193,14 +193,15 @@ next_uses_per_block(spill_ctx& ctx, unsigned block_idx, std::set<uint32_t>& work
aco_ptr<Instruction>& instr = block->instructions[idx];
assert(instr->opcode == aco_opcode::p_linear_phi || instr->opcode == aco_opcode::p_phi);
if (!instr->definitions[0].isTemp()) {
idx--;
continue;
std::pair<uint32_t, uint32_t> distance{block_idx, 0};
auto it = instr->definitions[0].isTemp() ? next_uses.find(instr->definitions[0].getTemp())
: next_uses.end();
if (it != next_uses.end()) {
distance = it->second;
next_uses.erase(it);
}
auto it = next_uses.find(instr->definitions[0].getTemp());
std::pair<uint32_t, uint32_t> distance =
it == next_uses.end() ? std::make_pair(block_idx, 0u) : it->second;
for (unsigned i = 0; i < instr->operands.size(); i++) {
unsigned pred_idx =
instr->opcode == aco_opcode::p_phi ? block->logical_preds[i] : block->linear_preds[i];
@ -212,7 +213,6 @@ next_uses_per_block(spill_ctx& ctx, unsigned block_idx, std::set<uint32_t>& work
ctx.next_use_distances_end[pred_idx][instr->operands[i].getTemp()] = distance;
}
}
next_uses.erase(instr->definitions[0].getTemp());
idx--;
}