[PATCH] Alternative solution for PR36343, missed call-clobbering due to TBAA pruning of points-to sets

Daniel Berlin dberlin@dberlin.org
Wed May 28 22:37:00 GMT 2008


On Wed, May 28, 2008 at 2:14 PM, Richard Guenther <rguenther@suse.de> wrote:
> On Wed, 28 May 2008, Daniel Berlin wrote:
>
>> This is fine by me.
>> You should be aware that trying to track which pointers point only to
>> non-local memory is, well, tricky.
>> I once replaced ANYTHING with NONLOCAL and made it compute the exact
>> set for ANYTHING, and this causes massive points-to set explosions
>> (see 4.2!)
>>
>> You would really need to compute points-to with NONLOCAL being a dummy
>> variable (IE don't allow adds to NONLOCAL), then compute escaping,
>> then add all the escaped variables to NONLOCAL, transitive close
>> NONLOCAL (IE add *NONLOCAL to NONLOCAL until it stops changing) and
>> treat it specially in *_what_p_points_to.
>
> I thought about just adding a global pt_nonlocal_id treating it
> as a strict subset of pt_anything_id.  That is, whenever I would
> add a constraint from anything I would omit the constraint from
> nonlocal.  And in the few places I know they are from nonlocal
> only (parameters and globals) I use the nonlocal constraint.
>
> I don't see the problem with adding to nonlocal or the requirement
> for the transitive closure - after all this isn't needed for
> pt_anyting_id either.

That's because we assume anything to really mean anything, and just
add all variables.
You said you wanted to figure out the actual set of variables that are
non-local, which involves calculating points-to and escape.


>   But I guess I'll figure that out during
> implementing it in the simple-minded way ;)

if you actually want to know the set NONLOCAL, you have two ways:

1. Add things to non-local as you go.
  a. This will cause NONLOCAL's set size to grow large.  A lot of
things will also have constraints of the form  = NONLOCAL  or
*NONLOCAL in them (due to being copied from parameters, which point to
nonlocal), which will cause their set size to grow very large as well
unless they are all eliminated by our variable elimination techniques
(which can't find absolutely all equivalences without calculating the
actual points-to sets themselves, which would make it just as bad as
the original problem it tries to solve, so it takes the road of "not
finding all equivalences")

2. Treat non-local as opaque during points-to, and figure out the set
later, to solve problem 1a.  The set non-local is equivalent to the
set of variables that escape + globals.  The variables that escape are
the variables that directly escape plus those that are pointed to by
escaping variables.  Notice that in order to calculate escaping, you
need points to, and in order to calculate points-to's nonlocal set,
you need escaping.  This is why you need an iteration of the two, or
you conservatively assume that nonlocal includes things it doesn't.

>
>> Alternatively, you could compute interprocedural MOD/REF for all
>> functions using the points-to info, and it will give you exact sets.
>
> Yeah, of course.  But that's a separate project ;)
>
> It seems I have to track down some Ada failures with the patch, so
> don't hold your breath.
>
> Thanks,
> Richard.
>



More information about the Gcc-patches mailing list