[Mesa-dev] [PATCH] nir/algebraic: Only replace an instruction once
Connor Abbott
cwabbott0 at gmail.com
Wed Jan 14 19:27:38 PST 2015
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Just curious, how did this come about?
On Wed, Jan 14, 2015 at 10:15 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> 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 at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list