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 PR38503, re-implement no-tbaa (placement-new, GIMPLE_CHANGE_DYNAMIC_TYPE)


On Mon, Jan 26, 2009 at 2:15 AM, Richard Guenther <rguenther@suse.de> wrote:
> On Sun, 25 Jan 2009, Richard Guenther wrote:
>
>> On Sat, 24 Jan 2009, Diego Novillo wrote:
>>
>> > On Sat, Jan 24, 2009 at 14:22, Richard Guenther <rguenther@suse.de> wrote:
>> >
>> > > +       /* If the reference is based on a decl and that is marked such
>> > > +          that type-based aliasing does not apply return alias set zero.  */
>> > > +       else if (DECL_P (inner)
>> > > +              && !MTAG_P (inner)
>> > > +              && DECL_NO_TBAA_P (inner))
>> > [ ... ]
>> > > --- 2955,2963 ----
>> > >    if (mem_alias_set == 0
>> > >        || DECL_POINTER_ALIAS_SET (ptr) == 0
>> > >        || TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (ptr))
>> > > !       || (DECL_P (var)
>> > > !         && !MTAG_P (var)
>> > > !         && DECL_NO_TBAA_P (var)))
>> >
>> > Maybe factor this into an inline predicate or macro?
>> >
>> > The rest looks fine to me.  Certainly cleaner than what we had before.
>>
>> Bah, this completely messes up tramp3d performance.  I'm trying to look
>> what goes "wrong" (well, I guess it just works correct now ...).
>
> Well, indeed.  The problem here is that we are attacking the problem
> with a flow-insensitive solution, so whenever we have no clue which
> memory we change the dynamic type of (the pointer points to
> anything) we have to effectively fall back to -fno-strict-aliasing.
> Without IPA or even whole-program PTA this is the usual case, not
> the exception.

Without context-sensitive PTA, this would still be the case for
non-whole programs with any externally visible function call in the
chain that was passing pointers (which is, well, most of them).


>
> Which simply means that trying to attack the problem this way is not
> going to work - unless, of course, you implement it in an incomplete
> way like we do now ;).

Well, actually, you could do something like the SMT implementation,
and create one "anything variable" per type and use them during PTA.
This would effectively give you TBAA results out of PTA, and let you
implement change dynamic type by adding the right "anything variable"
to the constraints at the CHANGE_DYNAMIC_TYPE site.


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