aco/spill: Don't spill phis with all-undef operands

Fixes some crashes when limiting RT stages to 128 VGPRs.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29593>
This commit is contained in:
Friedrich Vock
2024-06-07 12:08:32 +02:00
committed by Marge Bot
parent 80eda406d8
commit ec8512ce85

View File

@@ -548,6 +548,7 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
Block::edge_vec& preds =
phi->opcode == aco_opcode::p_phi ? block->logical_preds : block->linear_preds;
bool is_all_undef = true;
bool is_all_spilled = true;
bool is_partial_spill = false;
for (unsigned i = 0; i < phi->operands.size(); i++) {
@@ -557,9 +558,10 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
ctx.spills_exit[preds[i]].count(phi->operands[i].getTemp());
is_all_spilled &= spilled;
is_partial_spill |= spilled;
is_all_undef = false;
}
if (is_all_spilled) {
if (is_all_spilled && !is_all_undef) {
/* The phi is spilled at all predecessors. Keep it spilled. */
ctx.add_to_spills(phi->definitions[0].getTemp(), ctx.spills_entry[block_idx]);
spilled_registers += phi->definitions[0].getTemp();