On Wed, Jun 17, 2020 at 09:13:25AM +0200, Richard Biener via Gcc-patches wrote: > > Not doing the transformation I suggest at all, or not doing it in > > cases when the member does match the source? > > We are currently not treating different fields at the same offset as > "equal" before inlining completed for objsize to "work", thus leaving > optimizations on the plate.
As the first objsz pass runs quite early (the second one in pass_all_early_optimizations), we could just add a property for that and use it instead of the cfun->after_inlining check. And after that pass, we should be remembering the field limits in the IL explicitly as a MIN/MAX_EXPR for the bos call. Jakub