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: [PATCH] Fix call-clobbering (PRs 36373 and 36387)


On Fri, 30 May 2008, Daniel Berlin wrote:

> On Fri, May 30, 2008 at 6:12 PM, Richard Guenther <rguenther@suse.de> wrote:
> >
> > The current call-clobbering code as far as it deals with using
> > the PTA results is missing quite a few cases.  First escaped
> > aggregates (as opposed to pointers) are not tracked at all.
> 
> Only because you removed the code to do so when you removed SFT's :)

Let me add some general remarks.  I think the call-clobbering code
in 4.3 is broken, or at least very non-standard.

Let's see what is call clobbered?  All global memory is call clobbered.
And all memory reachable by escaped pointers is call clobbered.
Escaped pointers can either point to global memory or to local
memory that had its address taken.

A trivially correct solution is all globals and all local memory
that had its address taken.  We can improve that _only_ if we know
for every escaped pointer what it points to (as soon as we don't know
that for a single of them, we need to fallback to the trivial solution).
Luckily points-to computes a solution for the pointed-to memory
for all escaped pointers (hopefully without the need of pt_anything,
as then we're back to the trivial solution).  Now, we need to compute
what these escaped pointers may reach - points-to only gave us what
they directly point to.  Thus, we transitively close.

And viola - we have the call clobbered set which is all global
memory and all reachable memory from the escaped pointers.

Now that we use not only decls as symbols in our VOPs but sometimes
fall back to use SMTs and bare NMTs (and of course MPTs) imposes
the need to mark a set of those call clobbered as well - but this
should not have anything to do with computing the set of call
clobbered variables!  But instead this is an implementation detail
imposed by our memory SSA implementation.  At the moment both of
these parts are intermixed enough to make the code barely understandable
and comments like

      /* Name tags and symbol tags that we don't know where they point
         to, might point to global memory, and thus, are clobbered.

         FIXME:  This is not quite right.  They should only be
         clobbered if value_escapes_p is true, regardless of whether
         they point to global memory or not.
         So removing this code and fixing all the bugs would be nice.
         It is the cause of a bunch of clobbering.  */

doesn't make it possible to understand what is going on.  IMHO we
just clobber here and there just to make enough testcases work.  Without
actually trying to compute something meaningful at the start!

Ok, enough of a rant for now.

Richard.


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