aco/ra: handle copies of copies better
Instead of adding a second copy, just redirect the existing copy. No fossil-db changes. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11571>
This commit is contained in:
committed by
Marge Bot
parent
995e218993
commit
b14bd285f8
@@ -726,18 +726,33 @@ void update_renames(ra_ctx& ctx, RegisterFile& reg_file,
|
||||
if (is_def)
|
||||
continue;
|
||||
|
||||
std::pair<Operand, Definition>& copy = *it;
|
||||
|
||||
/* check if we moved another parallelcopy definition */
|
||||
for (std::pair<Operand, Definition>& other : parallelcopies) {
|
||||
if (!other.second.isTemp())
|
||||
continue;
|
||||
if (copy.first.getTemp() == other.second.getTemp()) {
|
||||
copy.first.setTemp(other.first.getTemp());
|
||||
copy.first.setFixed(other.first.physReg());
|
||||
if (it->first.getTemp() == other.second.getTemp()) {
|
||||
other.second.setFixed(it->second.physReg());
|
||||
ctx.assignments[other.second.tempId()].reg = other.second.physReg();
|
||||
it = parallelcopies.erase(it);
|
||||
is_def = true;
|
||||
/* check if we moved an operand, again */
|
||||
bool fill = true;
|
||||
for (Operand& op : instr->operands) {
|
||||
if (op.isTemp() && op.tempId() == other.second.tempId()) {
|
||||
// FIXME: ensure that the operand can use this reg
|
||||
op.setFixed(other.second.physReg());
|
||||
fill = (flags & fill_killed_ops) || !op.isKillBeforeDef();
|
||||
}
|
||||
}
|
||||
if (fill)
|
||||
reg_file.fill(other.second);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_def)
|
||||
continue;
|
||||
|
||||
std::pair<Operand, Definition>& copy = *it;
|
||||
copy.second.setTemp(ctx.program->allocateTmp(copy.second.regClass()));
|
||||
ctx.assignments.emplace_back(copy.second.physReg(), copy.second.regClass());
|
||||
assert(ctx.assignments.size() == ctx.program->peekAllocationId());
|
||||
|
||||
Reference in New Issue
Block a user