aco/spill: don't count phis as variable access
This increases the chance of evicting phis if these have longer next-use distances. Totals from 6 (0.00% of 146267) affected shaders (Navi10): CodeSize: 476992 -> 464388 (-2.64%) Instrs: 81785 -> 79952 (-2.24%) VClause: 2380 -> 2374 (-0.25%) Copies: 26836 -> 25131 (-6.35%) Branches: 2494 -> 2492 (-0.08%) Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>
This commit is contained in:
parent
b2a6346df7
commit
dfb10e4f4b
|
@ -184,15 +184,22 @@ void next_uses_per_block(spill_ctx& ctx, unsigned block_idx, std::set<uint32_t>&
|
||||||
aco_ptr<Instruction>& instr = block->instructions[idx];
|
aco_ptr<Instruction>& instr = block->instructions[idx];
|
||||||
assert(instr->opcode == aco_opcode::p_linear_phi || instr->opcode == aco_opcode::p_phi);
|
assert(instr->opcode == aco_opcode::p_linear_phi || instr->opcode == aco_opcode::p_phi);
|
||||||
|
|
||||||
|
if (!instr->definitions[0].isTemp()) {
|
||||||
|
idx--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
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++) {
|
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
||||||
unsigned pred_idx = instr->opcode == aco_opcode::p_phi ?
|
unsigned pred_idx = instr->opcode == aco_opcode::p_phi ?
|
||||||
block->logical_preds[i] :
|
block->logical_preds[i] :
|
||||||
block->linear_preds[i];
|
block->linear_preds[i];
|
||||||
if (instr->operands[i].isTemp()) {
|
if (instr->operands[i].isTemp()) {
|
||||||
if (ctx.next_use_distances_end[pred_idx].find(instr->operands[i].getTemp()) == ctx.next_use_distances_end[pred_idx].end() ||
|
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<uint32_t, uint32_t>{block_idx, 0})
|
ctx.next_use_distances_end[pred_idx][instr->operands[i].getTemp()] != distance)
|
||||||
worklist.insert(pred_idx);
|
worklist.insert(pred_idx);
|
||||||
ctx.next_use_distances_end[pred_idx][instr->operands[i].getTemp()] = {block_idx, 0};
|
ctx.next_use_distances_end[pred_idx][instr->operands[i].getTemp()] = distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next_uses.erase(instr->definitions[0].getTemp());
|
next_uses.erase(instr->definitions[0].getTemp());
|
||||||
|
|
Loading…
Reference in New Issue