aco: Fix optimization of v_cmp with subgroup invocation.
authorTimur Kristóf <timur.kristof@gmail.com>
Mon, 10 Apr 2023 11:14:02 +0000 (13:14 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Apr 2023 19:15:27 +0000 (19:15 +0000)
There was a typo in this optimization which went unnoticed.

Fixes: 2c40215ab9d20890efb88e7b3e26ca909d7fd74b
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22393>

src/amd/compiler/aco_optimizer.cpp

index 272ef84..cb31857 100644 (file)
@@ -2354,7 +2354,7 @@ bool
 optimize_cmp_subgroup_invocation(opt_ctx& ctx, aco_ptr<Instruction>& instr)
 {
    /* This optimization only applies to VOPC with 2 operands. */
-   if (instr->operands.size() == 2)
+   if (instr->operands.size() != 2)
       return false;
 
    /* Find the constant operand or return early if there isn't one. */
@@ -2420,7 +2420,7 @@ optimize_cmp_subgroup_invocation(opt_ctx& ctx, aco_ptr<Instruction>& instr)
 
    cpy->definitions[0] = instr->definitions[0];
    ctx.info[instr->definitions[0].tempId()].label = 0;
-   decrease_uses(ctx, ctx.instructions[mbcnt_op_idx].get());
+   decrease_uses(ctx, ctx.info[mbcnt_op.tempId()].instr);
    instr.reset(cpy);
 
    return true;