[Mesa-stable] [Mesa-dev] [PATCH] nir/vars_to_ssa: Rework copy set handling in lower_copies_to_load_store

Connor Abbott cwabbott0 at gmail.com
Thu Nov 12 21:54:56 PST 2015


Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

On Thu, Nov 12, 2015 at 10:02 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> Previously, we walked through a given deref_node's copies and, after
> lowering the copy away, removed it from both the source and destination
> copy sets.  This commit changes this to only remove it from the other
> node's copy set (not the one we're lowering).  At the end of the loop, we
> just throw away the copy set for the node we're lowering since that node no
> longer has any copies.  This has two advantages:
>
>  1) It's more efficient because we're doing potentially half as many set
>     search operations.
>
>  2) It now properly handles copies from a node to itself.  Perviously, it
>     would delete the copy from the set when processing the destinatioon and
>     then assert-fail when we couldn't find it for the source.
>
> Cc: "11.0" <mesa-stable at lists.freedesktop.org>
> Cc: Timothy Arceri <timothy.arceri at collabora.com>
> ---
>  src/glsl/nir/nir_lower_vars_to_ssa.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c b/src/glsl/nir/nir_lower_vars_to_ssa.c
> index 5971507..df24510 100644
> --- a/src/glsl/nir/nir_lower_vars_to_ssa.c
> +++ b/src/glsl/nir/nir_lower_vars_to_ssa.c
> @@ -455,7 +455,8 @@ lower_copies_to_load_store(struct deref_node *node,
>           struct deref_node *arg_node =
>              get_deref_node(copy->variables[i], state);
>
> -         if (arg_node == NULL)
> +         /* Only bother removing copy entries for other nodes */
> +         if (arg_node == NULL || arg_node == node)
>              continue;
>
>           struct set_entry *arg_entry = _mesa_set_search(arg_node->copies, copy);
> @@ -466,6 +467,8 @@ lower_copies_to_load_store(struct deref_node *node,
>        nir_instr_remove(&copy->instr);
>     }
>
> +   node->copies = NULL;
> +
>     return true;
>  }
>
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list