OSDN Git Service

nir: Use nir_src_copy instead of direct assignments.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 18 Jul 2017 04:08:42 +0000 (21:08 -0700)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 2 Aug 2017 23:19:06 +0000 (00:19 +0100)
commit891d1f8fea7ef55745f7cc0009eec6023818ac31
treeba489acb06279e5421763f30722fe81b187b645d
parentca17d32544f636db0fabc46ea0cdfe29bbc003fc
nir: Use nir_src_copy instead of direct assignments.

If the source is an indirect register, there is ralloc'd data.  Copying
with a direct assignment will copy the pointer, but the data will still
belong to the old instruction's memory context.  Since we're lowering
and throwing away instructions, that could free the data by mistake.

Instead, use nir_src_copy, which properly handles this.

This is admittedly not a common case, so I think the bug is real,
but unlikely to be hit.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 0320bb2c6cb27370e2389b392b63f8d05c7cb4c7)
[Emil Velikov: drop nir_lower_atomics_to_ssbo.c - not in branch]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/compiler/nir/nir_lower_atomics_to_ssbo.c
src/compiler/nir/nir_lower_atomics.c
src/compiler/nir/nir_lower_io_to_scalar.c