nir/search: fix nir_algebraic_automaton after constant folding op(bcsel)

Likely fixes https://gitlab.freedesktop.org/mesa/mesa/-/jobs/98917704

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: f4812dc11d ("nir/opt_constant_folding: constant-fold op(bcsel(), #c) -> bcsel(.., #c1, #c2)")
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41343>
This commit is contained in:
Rhys Perry 2026-05-04 15:10:37 +01:00 committed by Marge Bot
parent f47e7b7bd5
commit 081feabf9c

View file

@ -447,9 +447,9 @@ construct_value(nir_builder *build,
nir_alu_instr *bcsel = nir_def_as_alu(def);
assert(bcsel->op == nir_op_bcsel);
util_dynarray_append_typed(state->states, uint16_t, 0);
nir_algebraic_automaton(nir_src_parent_instr(&bcsel->src[1].src), state->states, state->pass_op_table);
nir_algebraic_automaton(nir_def_instr(bcsel->src[1].src.ssa), state->states, state->pass_op_table);
util_dynarray_append_typed(state->states, uint16_t, 0);
nir_algebraic_automaton(nir_src_parent_instr(&bcsel->src[2].src), state->states, state->pass_op_table);
nir_algebraic_automaton(nir_def_instr(bcsel->src[2].src.ssa), state->states, state->pass_op_table);
}
} else {
nir_builder_instr_insert(build, &alu->instr);