On 10/27/2017 04:38 AM, 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). Right. My recollection was there were tons of warnings when we tried to do this in the FE and everything we looked at was a false positive. Moving the warning to be more controlled by the backend was an effort to reduce the noise so that the result was actually meaningful.
Jeff