[Mesa-dev] [PATCH 1/4] glsl: Teach ir_variable_refcount about ir_loop::counter variables.

Paul Berry stereotype441 at gmail.com
Thu Nov 28 09:59:13 PST 2013

On 28 November 2013 09:29, Eric Anholt <eric at anholt.net> wrote:

> Paul Berry <stereotype441 at gmail.com> writes:
> > If an ir_loop has a non-null "counter" field, the variable referred to
> > by this field is implicitly read and written by the loop.  We need to
> > account for this in ir_variable_refcount, otherwise there is a danger
> > we will try to dead-code-eliminate the loop counter variable.
> >
> > Note: at the moment the dead code elimination bug doesn't occur due to
> > a bug in ir_hierarchical_visitor: it doesn't visit the "counter"
> > field, so dead code elimination doesn't treat it as a candidate for
> > elimination.  But the patch to follow will fix that bug, so we need to
> > fix ir_variable_refcount first in order to avoid breaking dead code
> > elimination.
> This series is:
> Reviewed-by: Eric Anholt <eric at anholt.net>
> I wish loop_control.cpp would make loop->control informational, and not
> muck with the existing control flow in the loop.  That way we could just
> ignore loop->control in the backend, and it would only get used by loop
> unrolling.  I'm pretty sure I've seen loops where both loop controls
> (loop->control and the original variable) end up getting used, and it's
> something that's going to be hard for the backend to fix back up.

Yeah, we talked about this on Tuesday.  I'm working on a patch series to
fix up this mess.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131128/d2c6f9ba/attachment.html>

More information about the mesa-dev mailing list