[Mesa-dev] [PATCH 4/8] nir: Properly invalidate metadata in nir_remove_dead_variables().

Jason Ekstrand jason at jlekstrand.net
Tue Nov 3 13:33:40 PST 2015


On Tue, Nov 3, 2015 at 12:31 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> We can't preserve dominance or live variable information.
>
> This also begs the question: what about globals?  Metadata only exists
> at the nir_function_impl level, so it would seem there is no metadata
> about global variables for us to invalidate.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/glsl/nir/nir_remove_dead_variables.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/nir/nir_remove_dead_variables.c b/src/glsl/nir/nir_remove_dead_variables.c
> index d6783e7..77b6c13 100644
> --- a/src/glsl/nir/nir_remove_dead_variables.c
> +++ b/src/glsl/nir/nir_remove_dead_variables.c
> @@ -126,8 +126,13 @@ nir_remove_dead_variables(nir_shader *shader)
>     progress = remove_dead_vars(&shader->globals, live) || progress;
>
>     nir_foreach_overload(shader, overload) {
> -      if (overload->impl)
> -         progress = remove_dead_vars(&overload->impl->locals, live) || progress;
> +      if (overload->impl) {
> +         if (remove_dead_vars(&overload->impl->locals, live)) {
> +            nir_metadata_preserve(overload->impl, nir_metadata_block_index |
> +                                                  nir_metadata_dominance);

This doesn't invalidate live_variables

> +            progress = true;
> +         }
> +      }
>     }
>
>     _mesa_set_destroy(live, NULL);
> --
> 2.6.2
>
> _______________________________________________
> 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