[tree-ssa] More CCP fixes [patch]
Jason Merrill
jason@redhat.com
Sun Aug 11 16:33:00 GMT 2002
On 11 Aug 2002 18:48:26 -0400, Diego Novillo <dnovillo@redhat.com> wrote:
> 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.
Yes, I'm suggesting it should.
> 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.
But how would you decide which expressions to remember? I can't think of
any scheme which would avoid requiring us to decide at some point that it's
OK to replace the rhs of a MODIFY_EXPR, but not the lhs.
Jason
More information about the Gcc-patches
mailing list