PATCH RFA: PR 29286: Handle placement new aliasing issues

Daniel Berlin dberlin@dberlin.org
Sun Jun 10 02:58:00 GMT 2007


On 6/9/07, Eric Botcazou <ebotcazou@adacore.com> wrote:
> > The basic issue is how to handle aliasing issues introduced by C++
> > placement new.  placement new dynamically changes the type of the
> > memory location to which it is applied.  That means that type based
> > alias analysis can not be applied to pointers which are returned from
> > placement new.  We tried some simplifications of that, but they failed
> > (details in the PR).  We tried simple fixes, like introducing a memory
> > barrier at placement new, but they caused optimization problems
> > (details in the PR).  The current patch appears to solve the problem
> > without introducing any significant optimization issues.
>
> Did you try TYPE_REF_CAN_ALIAS_ALL?  If so, why didn't it work in this case?

Because it's a huge hammer, and would disable all alias analysis for
that type, instead of just for the result of placement new.

Doing things like this results in about a 10% performance degradation
in tramp3d.

(BTW, remind me again why TYPE_REF_CAN_ALIAS_ALL is different than
returning alias set 0 for the type?)



More information about the Gcc-patches mailing list