<br><br><div class="gmail_quote">On Thu, Mar 22, 2012 at 5:09 PM, Johan Tibell <span dir="ltr">&lt;<a href="mailto:johan.tibell@gmail.com">johan.tibell@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
While looking at the GCC 4.7 [1] release notes I saw something that&#39;s<br>
perhaps worth stealing. Taken from the release notes:<br>
<br>
    The inter-procedural constant propagation pass has been rewritten. It<br>
    now performs generic function specialization. For example when<br>
    compiling the following:<br>
<br>
    void foo(bool flag)<br>
    {<br>
      if (flag)<br>
        ... do something ...<br>
      else<br>
        ... do something else ...<br>
    }<br>
    void bar (void)<br>
    {<br>
      foo (false);<br>
      foo (true);<br>
      foo (false);<br>
      foo (true);<br>
      foo (false);<br>
      foo (true);<br>
    }<br>
<br>
<br>
    GCC will now produce two copies of foo. One with flag being true,<br>
    while other with flag being false. This leads to performance<br>
    improvements previously possibly only by inlining all calls. Cloning<br>
    causes a lot less code size growth.<br></blockquote><div><br></div><div>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?</div>
<div><br></div><div>-Jan-Willem Maessen</div></div>