[Bug c++/54770] sibling call optimization is not applied where it ought to be
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 2 13:31:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54770
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-02 13:31:24 UTC ---
Right now we only have control flow insensitive points to ESCAPED set, so I'm
afraid this is unfixable, unless we change that. Only with control flow
sensitive ESCAPED we'd be able to clear the tmp var out of the escaped set at
the CLOBBER point (but it would need to be kept in other points to sets, as we
could e.g. CSE pure/const calls that return the var's address).
Another example where control flow insensitive ESCAPED prevents some
optimizations:
struct S { char p[40]; };
void bar (struct S *);
void foo (void)
{
struct S a, b, c, d, e;
a.p[0] = 1;
b.p[0] = 1;
c.p[0] = 1;
d.p[0] = 1;
e.p[0] = 1;
a.p[0] = 2;
bar (&a);
b.p[0] = 2;
bar (&b);
c.p[0] = 2;
bar (&c);
d.p[0] = 2;
bar (&d);
e.p[0] = 2;
bar (&e);
}
As we add all the vars into the ESCAPED set and consider it being used even by
the a call then, DSE can't optimize away the = 1 stores with the exception of
a.p[0] = 1;.
More information about the Gcc-bugs
mailing list