This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: compatibility of structs/unions/enums in the middle end
Am Mittwoch, den 02.10.2019, 14:18 +0200 schrieb Richard Biener:
> On Wed, Oct 2, 2019 at 1:57 PM Uecker, Martin
> <Martin.Uecker@med.uni-goettingen.de> wrote:
> >
Thank you for your answers.
> > Finally, how does LTO does it? It somehow also needs to unify
> > different tagged types? Could we reuse this mechanism somehow?
>
> LTO structurally merges types via TYPE_CANONICAL. But rules
> for merging depend on language semantics, too much merging
> hinders optimization.
LTO would need to merge types with identical tag and structure
across TUs anyway as this is needed for C programs to work.
But this implies that it also must merge such types inside a TU
(because merging enforces an equivalence relationship).
So if I am not missing anything important, LTO would already
implement the exact semantics which I propose for C2X.
Best,
Martin