diff options
author | Jason Ekstrand <[email protected]> | 2016-02-10 12:07:49 -0800 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-04-11 19:51:19 +0100 |
commit | c58258558fc5a922483915b4c32d76edbbd82ed5 (patch) | |
tree | 2aab3493feb12818158bfbd796cc56d8bd08e6da /src/glsl | |
parent | 3b9437c7012c33de6b207add677915f8837b973f (diff) |
nir/lower_vec_to_movs: Better report channels handled by insert_mov
This fixes two issues. First, we had a use-after-free in the case where
the instruction got deleted and we tried to return mov->dest.write_mask.
Second, in the case where we are doing a self-mov of a register, we delete
those channels that are moved to themselves from the write-mask. This
means that those channels aren't reported as being handled even though they
are. We now stash off the write-mask before remove unneeded channels so
that they still get reported as handled.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94073
Reviewed-by: Matt Turner <[email protected]>
Cc: "11.0 11.1" <[email protected]>
(cherry picked from commit 70dff4a55e767de8b9ce10f055b94ebb1f6a9755)
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/nir/nir_lower_vec_to_movs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c b/src/glsl/nir/nir_lower_vec_to_movs.c index 736a66c8639..0783596cd30 100644 --- a/src/glsl/nir/nir_lower_vec_to_movs.c +++ b/src/glsl/nir/nir_lower_vec_to_movs.c @@ -83,6 +83,8 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) } } + unsigned channels_handled = mov->dest.write_mask; + /* In some situations (if the vecN is involved in a phi-web), we can end * up with a mov from a register to itself. Some of those channels may end * up doing nothing and there's no reason to have them as part of the mov. @@ -103,7 +105,7 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) ralloc_free(mov); } - return mov->dest.write_mask; + return channels_handled; } static bool |