Stealing ideas from the latest GCC release
Jan-Willem Maessen
jmaessen at alum.mit.edu
Thu Mar 22 23:52:38 CET 2012
On Thu, Mar 22, 2012 at 5:09 PM, Johan Tibell <johan.tibell at gmail.com>wrote:
> Hi all,
>
> While looking at the GCC 4.7 [1] release notes I saw something that's
> perhaps worth stealing. Taken from the release notes:
>
> The inter-procedural constant propagation pass has been rewritten. It
> now performs generic function specialization. For example when
> compiling the following:
>
> void foo(bool flag)
> {
> if (flag)
> ... do something ...
> else
> ... do something else ...
> }
> void bar (void)
> {
> foo (false);
> foo (true);
> foo (false);
> foo (true);
> foo (false);
> foo (true);
> }
>
>
> GCC will now produce two copies of foo. One with flag being true,
> while other with flag being false. This leads to performance
> improvements previously possibly only by inlining all calls. Cloning
> causes a lot less code size growth.
>
Wait, I thought this is essentially what constructor specialization does?
I suppose we might then keep around the old body. Or will these behave
differently in the presence of, say, different constant Int arguments?
-Jan-Willem Maessen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120322/eee95191/attachment.htm>
More information about the Glasgow-haskell-users
mailing list