Commit 0d05d122 authored by Jason Ekstrand's avatar Jason Ekstrand
Browse files

nir/algebraic: Only replace an instruction once

Without the break, it was possible that an instruction would match multiple
expressions.  If this happened, you could end up trying to replace it
multiple times and get a segfault.  This makes it so that, after a
successful replacement, it moves on to the next instruction.
Reviewed-by: default avatarConnor Abbott <>
parent c56adc68
......@@ -192,8 +192,10 @@ ${pass_name}_block(nir_block *block, void *void_state)
for (unsigned i = 0; i < ARRAY_SIZE(${pass_name}_${opcode}_xforms); i++) {
if (nir_replace_instr(alu, ${pass_name}_${opcode}_xforms[i].search,
state->mem_ctx)) {
state->progress = true;
% endfor
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment