aco/optimizer: Propagate scc_needed label through p_wqm.

Without this, RA is confused and adds a bunch of unnecessary moves.

Fossil-db results (Navi 10):

Totals from 7658 (5.55% of 137887) affected shaders:
SGPRs: 752488 -> 752392 (-0.01%)
CodeSize: 74046720 -> 73924368 (-0.17%); split: -0.17%, +0.00%
Instrs: 14293916 -> 14263350 (-0.21%); split: -0.21%, +0.00%
Cycles: 1455556728 -> 1438466536 (-1.17%); split: -1.17%, +0.00%
VMEM: 1096736 -> 1094962 (-0.16%); split: +0.03%, -0.19%
SMEM: 448436 -> 448418 (-0.00%); split: +0.00%, -0.01%
SClause: 485501 -> 485495 (-0.00%); split: -0.00%, +0.00%
Copies: 1383769 -> 1353029 (-2.22%); split: -2.22%, +0.00%
Branches: 568247 -> 568451 (+0.04%); split: -0.01%, +0.05%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7677>
This commit is contained in:
Timur Kristóf 2020-02-05 12:14:00 +01:00 committed by Marge Bot
parent 8bd3fefb74
commit df940760f9

View file

@ -3244,6 +3244,14 @@ void select_instruction(opt_ctx &ctx, aco_ptr<Instruction>& instr)
instr->opcode == aco_opcode::s_cselect_b32) &&
instr->operands[2].isTemp()) {
ctx.info[instr->operands[2].tempId()].set_scc_needed();
} else if (instr->opcode == aco_opcode::p_wqm &&
instr->operands[0].isTemp() &&
ctx.info[instr->definitions[0].tempId()].is_scc_needed()) {
/* Propagate label so it is correctly detected by the uniform bool transform */
ctx.info[instr->operands[0].tempId()].set_scc_needed();
/* Fix definition to SCC, this will prevent RA from adding superfluous moves */
instr->definitions[0].setFixed(scc);
}
/* check for literals */