This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ast-optimizer-branch]: SAVE_EXPR's not simplified right


On Mon, 6 May 2002, Diego Novillo wrote:

> On Sat, 04 May 2002, Daniel Berlin wrote:
> 
> > Diego, have you hit this yet?
> >
> Yes.  Disabling save_expr simplification helps.  
This is what I did.
> Another source
> of problems is the new expression unsharing code I added last
> week.  It's starting to look like a horrible idea.

Yup.

Though I have to copy when simplifying stmt_expr's, however, or else we 
end up creating circular chains when they are shared, and we move it to before a 
shared occurred.

I.e.

a = ({5})
b = ({5})

if we change it to

{
 T.1 = 5
}
a = T.1

without copying before adding, we get a circular chain like so:

{
 T.1 = 5
}
a = T.1
b = { 
T.1 = 5
}
a = T.1
b = {
T.1 = 5
}
....



I added aborts when we try to copy things we shouldn't (things that have 
their own RTL, _DECL's, etc) , and haven't hit an abort during bootstrap.

 > 
> If we disable save_expr simplification, we get this one right
> but we still create unnecessary expression copies.
> 

I also tried only simplifying what's *in* the save_expr, but it doesn't 
completely fix it.

It *does* fix a lot of cases however, so it might be workable.

The cases it doesn't handle right are those where we have a 
self-modifying expression multiple times in the same stmt.

I.E. 
r++ &= s++

because we still end up simplifying into a new temporary, and thus, 
ruining the point of the save_expr, and changing semantics.

So i'm not sure if it's workable or not.

> 
> Diego.
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]