This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] tree-ssa-ccp.c: Propagate even more ADDR_EXPRs.
Hi Jeff,
> I'm not sure if we want to bother with this in CCP. The forward
> propagation code already handles this case rather effectively. What's
> the real benefit from doing the same optimization in CCP that we're
> already doing in forwprop.c?
One difference would be that forwprop cares about the number of
immediate uses regardless of whether an ADDR_EXPR is invariant or not,
whereas CCP cares only about invariants and propagates them as far as
possible.
One could argue that if we do this optimization in CCP, we may be able
to eliminate a comparison of two ADDR_EXPRs like so
struct f {
int i;
};
void
foo (void)
{
struct f a;
struct f *p;
int *q, *r;
a.i = 1;
p = &a;
q = &p->i;
r = &p->i;
if (q != r)
link_error ();
}
but that would be extremely rare, I'd say.
Kazu Hirata