[Mesa-dev] [PATCH] glsl/constant propagation: kill whole var if LHS involves array indexing.
Eric Anholt
eric at anholt.net
Tue May 22 14:41:01 PDT 2012
On Sat, 19 May 2012 10:08:20 -0700, Paul Berry <stereotype441 at gmail.com> wrote:
> When considering which components of a variable were killed by an
> assignment, constant propagation would previously just use the write
> mask of the assignment. This worked if the LHS of the assignment was
> simple, e.g.:
>
> v.xy = ...; // (assign (xy) (var_ref v) ...)
>
> But it did the wrong thing if the LHS of the assignment involved an
> array indexing operator, since in this case the write mask is always
> (x):
>
> v[i] = ...; // (assign (x) (deref_array (var_ref v) (var_ref i)) ...)
>
> In general, we can't predict which vector component will be selected
> by array indexing, so the only safe thing to do in this case is to
> kill the entire variable.
>
> Fixes piglit tests {fs,vs}-vector-indexing-kills-all-channels.shader_test.
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120522/fd78bb49/attachment.pgp>
More information about the mesa-dev
mailing list