summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-07-01 16:00:08 -0700
committerJason Ekstrand <[email protected]>2015-07-02 15:42:33 -0700
commit89bd5ee64c5aa1b977f4ba832cf7772e81ee286d (patch)
tree57d9d9a1bf4b95b6d535b3e0687f9fe42a4e4cad
parent197a19f9ed0ba12cc431542ac09f2af0a8bd0bce (diff)
nir: Don't allow copying SSA destinations
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/glsl/nir/nir.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index f661249f9bb..78ff886218d 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;
}
}