Re: Enable TBAA on anonymous types with LTO

2014-10-01 Thread Jan Hubicka
> > Ok, as Jason explained this wouldn't work, so we indeed need to stream > TYPE_CANONICAL in this case (and also properly SCC-walk it!) Yep, my patch streams and SCC walks them when they are anonymous. By incremental patch I plan to handle all ODR and component types, so basically stream canoni

Re: Enable TBAA on anonymous types with LTO

2014-10-01 Thread Richard Biener
On Mon, Sep 29, 2014 at 5:36 PM, Jan Hubicka wrote: >> >> Why not just make all anonymous types their own canonical type? >> (of course considering type variants) > > If C++ FE sets canonical type always to main variant, it should work. > Is it always the case? I noticed you do this for variadic t

Re: Enable TBAA on anonymous types with LTO

2014-09-30 Thread Jan Hubicka
> On 09/29/2014 11:36 AM, Jan Hubicka wrote: > >If C++ FE sets canonical type always to main variant, it should work. > >Is it always the case? > > No. For a compound type like a pointer or function the canonical > type strips all typedefs, but a main variant does not. > > >>> namespace {

Re: Enable TBAA on anonymous types with LTO

2014-09-30 Thread Jason Merrill
On 09/29/2014 11:36 AM, Jan Hubicka wrote: If C++ FE sets canonical type always to main variant, it should work. Is it always the case? No. For a compound type like a pointer or function the canonical type strips all typedefs, but a main variant does not. namespace { struct B

Re: Enable TBAA on anonymous types with LTO

2014-09-29 Thread Jan Hubicka
> > > > Why not just make all anonymous types their own canonical type? > > (of course considering type variants) > > If C++ FE sets canonical type always to main variant, it should work. > Is it always the case? I noticed you do this for variadic types. > I tought there is reason why canonical t

Re: Enable TBAA on anonymous types with LTO

2014-09-29 Thread Jan Hubicka
> > Why not just make all anonymous types their own canonical type? > (of course considering type variants) If C++ FE sets canonical type always to main variant, it should work. Is it always the case? I noticed you do this for variadic types. I tought there is reason why canonical types differ fr

Re: Enable TBAA on anonymous types with LTO

2014-09-29 Thread Richard Biener
On Fri, 26 Sep 2014, Jan Hubicka wrote: > Hello, > this is patch to preserve TBAA for anonymous types to LTO. The difference > can be seen on the testcase: > > namespace > { > struct A {int a;}; > struct B {int b;}; > } > > struct A aa,*a=&aa; > struct B bb,*b=&bb; > > void > setA() > { >