
On Thu, Mar 22, 2012 at 5:09 PM, Johan Tibell
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