Use ODR for canonical types construction in LTO

Jan Hubicka hubicka@ucw.cz
Wed Jun 19 17:53:00 GMT 2019


> > > -    ctype = CLASSTYPE_AS_BASE (ctype);
> > > +    {
> > > +      if (!tree_int_cst_equal (TYPE_SIZE (ctype),
> > > +			       TYPE_SIZE (CLASSTYPE_AS_BASE (ctype))))
> > > +        ctype = CLASSTYPE_AS_BASE (ctype);
> > > +    }
> > >     tree clobber = build_clobber (ctype);
> 
> I have noticed we build a distinct as-base type in rather more cases than
> strictly necessary.  For instance when there's a member of reference type or
> we have a non-trivial dtor. (CLASSTYPE_NON_LAYOUT_POD_P gets set by a bunch
> of things that don't affect ABI layout)

Avoiding the extra copies at first place would be great. In my
understanding the types differ by virtual bases and also by their size
since the fake types are not padded to multiply of their alignment.
I guess this can be tested ahead of producing the copy and saving some
memory...

I am not sure if my C++ FE abilities are on par to implement this tough.
Honza
> 
> nathan
> 
> -- 
> Nathan Sidwell



More information about the Gcc-patches mailing list