This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR38503, re-implement no-tbaa (placement-new, GIMPLE_CHANGE_DYNAMIC_TYPE)
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.
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 ;).
Which brings us back to my very original solution to this problem,
avoid hoisting stores and sinking loads - either in general or just
around a special barrier instruction. Which is (I guess) the way
other compilers deal with this?
To conclude - I am going to introduce some minor "tweaks" to fix
PR38503 instead of fixing the imperfect DECL_NO_TBAA_P implementation.
Richard.