[ast-optimizer-branch] Bootstrap fixes [patch]
Daniel Berlin
dberlin@dberlin.org
Tue May 7 13:21:00 GMT 2002
On 7 May 2002, Diego Novillo wrote:
> On Tue, 2002-05-07 at 14:41, Daniel Berlin wrote:
>
> > I only need to disable simplify_self_mod_expr and simplify_save_expr to be
> > able to bootstrap before.
> >
> > This includes simplifying statement expressions.
> >
> Oh, that's good news. Could you post the patch? I'm now tracking the
> C++ library failure.
>
>
> > Not copying nodes also ends up making optimizations harder. For things
> > like copy-prop, i now have to make sure we don't screw over shared
> > expressions when replacing.
> >
> But that would've been true before the simplify pass, wouldn't it?
> By
> not copying the expressions we are just preserving the initial sharing.
> We only need to be careful not to clobber special nodes like constants,
> decls and types.
No, we share more than that, unfortunately, because of simplification
expanding the sharing.
In fact, i ended up with a case (it's in simple-break-elim in
construct_case_body_labels or whatever that routine is called) where we
had, after simplification:
T.271 = *node.common.code
....
{
T.271 = *node.common.code;
}
....
Which was
EXPR_STMT_EXPR
MODIFY_EXPR
VAR_DECL T.271
NOP_EXPR
COMPONENT_REF
COMPONENT_REF
INDIRECT_REF
VAR_DECL (node)
The NOP_EXPR down was shared in both statements, but the refs were all to
the indirect_ref.
So replacement of the indirect_ref in one changed the other one, since it
was still shared up at NOP_EXPR.
It was because we didn't copy the expression before simplification, but
replaced it's operands, such that it changed it in both places. Later,
for other reasons (such as not testing before building a new statement in
a few cases), we ended up building a new modify expr/expr_stmt_expr out
of it, but since the right hand side was already simple, we just reused
it.
> > > Diego. >
More information about the Gcc-patches
mailing list