This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [trans-mem] cgraph edges vs function cloning
Hi,
On Tue, Jul 28, 2009 at 04:26:12PM -0700, Richard Henderson wrote:
> On 07/28/2009 10:44 AM, Richard Henderson wrote:
> >I guess I'll poke at cleaning this up today. I've got to
> >familiarize myself with how virtual clones work...
>
> The virtual clones that ipa-cp makes seems to be easy.
>
> My thought here is that since (virtual) clones don't
> have actual bodies (and when they acquire bodies they
> cease to be clones), then there's no reason for them
> to have callee edges at all.
That is not really true. Consider the following example:
static void a (int i)
{
DO_SOMETHING_WITH_I (i);
}
void b (int i) /* Not static! */
{
a (i);
}
void c (void)
{
b (2);
}
After ipa-cp (even today), we might end up with a call graph where c
would call b.clone.0 which in turn would call a.clone.1, while the
original b would still call the original a.
Moreover, I have an ipa-cp improvemant patch that removes callee edges
of virtual clones if it can prove that they are never called after a
constant is substituted into a parameter, like in the example below:
int f(int i)
{
if (i == 0)
{
call_some_nasty_function(...);
}
...
}
int g() {return f(1);}
Martin