On Mon, 1 Aug 2011 22:16:40 -0700, Paul Berry <stereotype...@gmail.com> wrote: > On 1 August 2011 17:35, Ian Romanick <i...@freedesktop.org> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > On 08/01/2011 04:07 PM, Paul Berry wrote: > >> opt_dead_functions contained a shortcut to skip processing the first > >> function's body, based on the assumption that IR functions are > >> topologically sorted, with callees always coming before their callers > >> (therefore the first function cannot contain any calls). > > > > After linking, that is absolutely true. > > > > When linking, we start with an empty shader. Then we find main, and > > pull it in. For each function pulled in (initially just main), we > > recursively pull in all the called functions. > > > > In the absence of cycles (i.e., recursion), that should guarantee the > > desired sort order. Right? > > Hmm, what you say makes sense, but there must be something more subtle > going on, because what led me to make this patch was that I first > tried writing the rest of the patch series, and then when I tested it > I ran into problems because at link time, the functions weren't sorted > in callee-to-caller order. > > I will investigate things further in the morning and let you know what I find.
Since we only have one ir_function per function name, we might still be able to construct your failure by calling everything f(some args). I like the is_leaf() idea for implementing this optimization much better, though.
pgpsmNHwNRvm9.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev