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. --- src/glsl/nir/nir_algebraic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/glsl/nir/nir_algebraic.py b/src/glsl/nir/nir_algebraic.py index 72703be..f9b246d 100644 --- a/src/glsl/nir/nir_algebraic.py +++ b/src/glsl/nir/nir_algebraic.py @@ -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, ${pass_name}_${opcode}_xforms[i].replace, - state->mem_ctx)) + state->mem_ctx)) { state->progress = true; + break; + } } break; % endfor -- 2.2.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev