diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 70bf5e8962f..300356d1f3c 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -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;