[Mesa-dev] [PATCH] nir: Don't allow copying SSA destinations
Connor Abbott
cwabbott0 at gmail.com
Wed Jul 1 16:03:29 PDT 2015
Assuming this passes piglit,
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
On Wed, Jul 1, 2015 at 4:00 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> ---
> src/glsl/nir/nir.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
> index f661249..78ff886 100644
> --- a/src/glsl/nir/nir.c
> +++ b/src/glsl/nir/nir.c
> @@ -147,18 +147,18 @@ void nir_src_copy(nir_src *dest, const nir_src *src, void *mem_ctx)
>
> void nir_dest_copy(nir_dest *dest, const nir_dest *src, void *mem_ctx)
> {
> - dest->is_ssa = src->is_ssa;
> - if (src->is_ssa) {
> - dest->ssa = src->ssa;
> + /* Copying an SSA definition makes no sense whatsoever. */
> + assert(!src->is_ssa);
> +
> + dest->is_ssa = false;
> +
> + dest->reg.base_offset = src->reg.base_offset;
> + dest->reg.reg = src->reg.reg;
> + if (src->reg.indirect) {
> + dest->reg.indirect = ralloc(mem_ctx, nir_src);
> + nir_src_copy(dest->reg.indirect, src->reg.indirect, mem_ctx);
> } else {
> - dest->reg.base_offset = src->reg.base_offset;
> - dest->reg.reg = src->reg.reg;
> - if (src->reg.indirect) {
> - dest->reg.indirect = ralloc(mem_ctx, nir_src);
> - nir_src_copy(dest->reg.indirect, src->reg.indirect, mem_ctx);
> - } else {
> - dest->reg.indirect = NULL;
> - }
> + dest->reg.indirect = NULL;
> }
> }
>
> --
> 2.4.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