[Mesa-dev] [PATCH] nir: Mark the shader name during nir_sweep

Jason Ekstrand jason at jlekstrand.net
Thu Oct 8 08:03:38 PDT 2015


On Thu, Oct 8, 2015 at 7:58 AM, Neil Roberts <neil at linux.intel.com> wrote:
> Previously the name of the nir shader was being freed prematurely
> during nir_sweep. Since 756613ed35d the name was later being used to
> generate filenames for the optimiser debug output and these would end
> up with garbage from the dangling pointer.

I sent this patch yesterday.  Your commit message is better but mine
adds a cast to avoid compiler warnings.  If you'd like to add the cast
below, you can go ahead and push with my

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

I'm sure you can steal Matt's R-B from mine as well.

Or, for that matter, I can steal your commit message and turn this
into an R-B?  I don't care...
--Jason

> ---
>  src/glsl/nir/nir_sweep.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/glsl/nir/nir_sweep.c b/src/glsl/nir/nir_sweep.c
> index d354975..082403f 100644
> --- a/src/glsl/nir/nir_sweep.c
> +++ b/src/glsl/nir/nir_sweep.c
> @@ -154,6 +154,9 @@ nir_sweep(nir_shader *nir)
>     /* First, move ownership of all the memory to a temporary context; assume dead. */
>     ralloc_adopt(rubbish, nir);
>
> +   /* The shader name is not dead */
> +   ralloc_steal(nir, nir->info.name);

You need to cast the const away from nir->info.name or you'll get
compiler warnings.

> +
>     /* Variables and registers are not dead.  Steal them back. */
>     steal_list(nir, nir_variable, &nir->uniforms);
>     steal_list(nir, nir_variable, &nir->inputs);
> --
> 1.9.3
>
> _______________________________________________
> 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