On Fri, 27 Oct 2017, Jakub Jelinek wrote:

> On Fri, Oct 27, 2017 at 12:31:46PM +0200, Richard Biener wrote:
> > I fear it doesn't work at all with LTO (you'll always get the old ABI
> > if I read the patch correctly).  This is because the function
> > computing the size looks at flag_abi_version which isn't saved
> > per function / TU.
> > 
> > Similarly you'll never get the ABI warning with LTO (less of a big
> > deal of course) because the langhook doesn't reflect things correctly
> > either.
> > 
> > So...  can we instead compute whether a type is "empty" according
> > to the ABI early and store the result in the type (thinking of
> > doing this in layout_type?).  Similarly set a flag whether to
> > warn.  Why do you warn from backends / code emission and not
> > from the FEs?  Is that to avoid warnings for calls that got inlined?
> > Maybe the FE could set a flag on the call itself (ok, somewhat
> > awkward to funnel through gimple).
> 
> Warning in the FE is too early both because of the inlining, never
> emitted functions and because whether an empty struct is passed differently
> from the past matters on the backend (whether its psABI says it should be
> not passed at all or not).
> 
> Perhaps if empty types are rare enough it could be an artificial attribute
> on the type if we can't get a spare bit for that.  But computing in the FE
> or before free_lang_data and saving on the type whether it is empty or not
> seems reasonable to me.

There are 18 unused bits in tree_type_common if we don't want to re-use
any.  For the warning I first thought of setting TREE_NO_WARNING on it
but that bit is used already.  OTOH given the "fit" of TREE_NO_WARNING
I'd move TYPE_ARTIFICIAL somewhere else.

Richard.

Reply via email to