Merging identical functions in GCC

Michael Popov pmike2001@mail.ru
Sat Sep 16 07:22:00 GMT 2006


Daniel Berlin wrote:
> Actually, even for non-POD types, it catches a lot of templatized
> member functions that mainly depend on size (but they are still
> container classes).
Just another ( maybe stupid :-) ) idea. What about "partial merge"?

static int x = 0;
void a()
{
     printf( "aaa" );
     x = x + 1;
     return;
}
void b()
{
     printf( "bbb" );
     x = x + 1;
     return;
}

In sample code functions a() and b() aren't identical, but
after push of first printf's argument they become identical.
So, setting JMP in b() into a()'s code should produce valid code.



More information about the Gcc mailing list