This is the mail archive of the gcc@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: Ada bootstrap failure due to loop optimization and builtin_stack_alloc


Hello,

> > while (...)
> >   {
> >     builtin_stack_alloc (&array, size);
> > 
> >     arraystart_1 = &array;
> > 
> >     use (*arraystart_1);
> >   }
> > 
> > Since there is no USE nor VUSE operand on the arraystart_1 = &array;
> > statement, loop invariant motion decides that it is invariant inside the
> > loop and moves it out, which is wrong.
> > 
> Hmm, yes.  The safe, if silly, thing to do here is to not mark LI the
> statement 'arraystart_1 = &array'.  We don't keep track of values in our
> SSA form, so this program is changing things behind the optimizer's
> back.
> 
> However, the deeper problem here is that not all the semantics of
> builtin_stack_alloc are exposed in the IL.  If &array changes, I would
> expect to see code like you proposed in
> http://gcc.gnu.org/ml/gcc/2004-07/msg01319.html
> 
> What happened with the change you had proposed last year?  Jason didn't
> seem opposed to it.  It would represent the exact semantics of what is
> going on in this loop.

there were objections based on the fact that it destroys debugging info.
And somehow I got persuaded that the current approach works correctly.

Zdenek

> For the time being, we could take the pessimistic approach of not
> marking loop invariant ADDR_EXPRs that are not is_gimple_min_invariant. 
> But overloading the semantics of ADDR_EXPR to imply an operand where
> there is none is not a good option IMO.
> 
> 
> Diego.


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