aco/ra: fix live-range splits of phi definitions
It could happen that at the time of a live-range split, a phi was not yet placed in the new instruction vector, and thus, instead of renamed, a new phi was created. Fixes: dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_i8vec2 Cc: mesa-stable Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16248>
This commit is contained in:
parent
d639608b8b
commit
58bd9a379e
|
@ -2052,12 +2052,18 @@ void
|
||||||
get_regs_for_phis(ra_ctx& ctx, Block& block, RegisterFile& register_file,
|
get_regs_for_phis(ra_ctx& ctx, Block& block, RegisterFile& register_file,
|
||||||
std::vector<aco_ptr<Instruction>>& instructions, IDSet& live_in)
|
std::vector<aco_ptr<Instruction>>& instructions, IDSet& live_in)
|
||||||
{
|
{
|
||||||
/* assign phis with all-matching registers to that register */
|
/* move all phis to instructions */
|
||||||
for (aco_ptr<Instruction>& phi : block.instructions) {
|
for (aco_ptr<Instruction>& phi : block.instructions) {
|
||||||
if (!is_phi(phi))
|
if (!is_phi(phi))
|
||||||
break;
|
break;
|
||||||
|
if (!phi->definitions[0].isKill())
|
||||||
|
instructions.emplace_back(std::move(phi));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* assign phis with all-matching registers to that register */
|
||||||
|
for (aco_ptr<Instruction>& phi : instructions) {
|
||||||
Definition& definition = phi->definitions[0];
|
Definition& definition = phi->definitions[0];
|
||||||
if (definition.isKill() || definition.isFixed())
|
if (definition.isFixed())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!phi->operands[0].isTemp())
|
if (!phi->operands[0].isTemp())
|
||||||
|
@ -2079,11 +2085,9 @@ get_regs_for_phis(ra_ctx& ctx, Block& block, RegisterFile& register_file,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to find a register that is used by at least one operand */
|
/* try to find a register that is used by at least one operand */
|
||||||
for (aco_ptr<Instruction>& phi : block.instructions) {
|
for (aco_ptr<Instruction>& phi : instructions) {
|
||||||
if (!is_phi(phi))
|
|
||||||
break;
|
|
||||||
Definition& definition = phi->definitions[0];
|
Definition& definition = phi->definitions[0];
|
||||||
if (definition.isKill() || definition.isFixed())
|
if (definition.isFixed())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* use affinity if available */
|
/* use affinity if available */
|
||||||
|
@ -2116,25 +2120,16 @@ get_regs_for_phis(ra_ctx& ctx, Block& block, RegisterFile& register_file,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find registers for phis where the register was blocked or no operand was assigned */
|
/* find registers for phis where the register was blocked or no operand was assigned */
|
||||||
for (aco_ptr<Instruction>& phi : block.instructions) {
|
for (aco_ptr<Instruction>& phi : instructions) {
|
||||||
if (!is_phi(phi))
|
|
||||||
break;
|
|
||||||
|
|
||||||
Definition& definition = phi->definitions[0];
|
Definition& definition = phi->definitions[0];
|
||||||
if (definition.isKill())
|
if (definition.isFixed())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (definition.isFixed()) {
|
|
||||||
instructions.emplace_back(std::move(phi));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
definition.setFixed(
|
definition.setFixed(
|
||||||
get_reg_phi(ctx, live_in, register_file, instructions, block, phi, definition.getTemp()));
|
get_reg_phi(ctx, live_in, register_file, instructions, block, phi, definition.getTemp()));
|
||||||
|
|
||||||
register_file.fill(definition);
|
register_file.fill(definition);
|
||||||
ctx.assignments[definition.tempId()].set(definition);
|
ctx.assignments[definition.tempId()].set(definition);
|
||||||
instructions.emplace_back(std::move(phi));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue