aco: Fix how p_elect interacts with optimizations.

Since p_elect doesn't have any operands, ACO's value numbering and/or
the pre-RA optimizer could currently recognize two p_elect instructions
in two different blocks as the same.

This patch adds exec as an operand to p_elect in order to achieve
correct behavior.

Fixes: e66f54e5c8
Closes: #5080
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/11943>
This commit is contained in:
Timur Kristóf 2021-07-17 23:25:52 +02:00 committed by Daniel Schürmann
parent 749251391d
commit 55d57b828f
1 changed files with 5 additions and 1 deletions

View File

@ -8722,7 +8722,11 @@ visit_intrinsic(isel_context* ctx, nir_intrinsic_instr* instr)
break;
}
case nir_intrinsic_elect: {
Temp elected = bld.pseudo(aco_opcode::p_elect, bld.def(bld.lm));
/* p_elect is lowered in aco_insert_exec_mask.
* Use exec as an operand so value numbering and the pre-RA optimizer won't recognize
* two p_elect with different exec masks as the same.
*/
Temp elected = bld.pseudo(aco_opcode::p_elect, bld.def(bld.lm), Operand(exec, bld.lm));
emit_wqm(bld, elected, get_ssa_temp(ctx, &instr->dest.ssa));
ctx->block->kind |= block_kind_needs_lowering;
break;