aco: make program->needs_vcc independent of VCC hints

Totals from 5 (0.00% of 135048) affected shaders: (GFX9)
SGPRs: 208 -> 160 (-23.08%)
CodeSize: 2700 -> 2692 (-0.30%)
Instrs: 533 -> 531 (-0.38%)
Latency: 41688 -> 41680 (-0.02%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15408>
This commit is contained in:
Daniel Schürmann 2022-03-16 10:56:26 +01:00 committed by Marge Bot
parent 415a3820fc
commit b10c4d7dee
1 changed files with 18 additions and 2 deletions

View File

@ -88,6 +88,21 @@ struct PhiInfo {
uint16_t linear_phi_defs = 0;
};
bool
instr_needs_vcc(Instruction* instr)
{
if (instr->isVOPC())
return true;
if (instr->isVOP2() && !instr->isVOP3()) {
if (instr->operands.size() == 3 && instr->operands[2].isTemp() &&
instr->operands[2].regClass().type() == RegType::sgpr)
return true;
if (instr->definitions.size() == 2)
return true;
}
return false;
}
void
process_live_temps_per_block(Program* program, live& lives, Block* block, unsigned& worklist,
std::vector<PhiInfo>& phi_info)
@ -111,6 +126,7 @@ process_live_temps_per_block(Program* program, live& lives, Block* block, unsign
if (is_phi(insn))
break;
program->needs_vcc |= instr_needs_vcc(insn);
register_demand[idx] = RegisterDemand(new_demand.vgpr, new_demand.sgpr);
/* KILL */
@ -118,7 +134,7 @@ process_live_temps_per_block(Program* program, live& lives, Block* block, unsign
if (!definition.isTemp()) {
continue;
}
if ((definition.isFixed() || definition.hasHint()) && definition.physReg() == vcc)
if (definition.isFixed() && definition.physReg() == vcc)
program->needs_vcc = true;
const Temp temp = definition.getTemp();
@ -189,7 +205,7 @@ process_live_temps_per_block(Program* program, live& lives, Block* block, unsign
continue;
}
Definition& definition = insn->definitions[0];
if ((definition.isFixed() || definition.hasHint()) && definition.physReg() == vcc)
if (definition.isFixed() && definition.physReg() == vcc)
program->needs_vcc = true;
const Temp temp = definition.getTemp();
const size_t n = live.erase(temp.id());