This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] More CCP fixes [patch]
On Sun, 2002-08-11 at 18:31, Jason Merrill wrote:
> On Sun, 11 Aug 2002 17:51:14 -0400, Diego Novillo <dnovillo@redhat.com> wrote:
>
> > 2- unsorted/i++.c fails because in:
> >
> > i = 2;
> > i = i;
> >
> > CCP replaces the second assignment with '2 = i'. As per Dan's
> > suggestion, we need to keep pointers to the expressions that
> > contain them.
>
> Or not try to do replacement on expressions used in an lvalue context.
>
That would only paper over the problem. The real bug is that when we
try to do replacements, we call find_expr_in_tree(), which returns the
first VAR_DECL i that it finds. The function does not know which
sub-tree to return.
On the other hand, if we tell every varref to store a pointer to its
parent expression, the optimizers can replace these expressions without
having to walk the expression tree again.
Diego.