RFC: variant and ODR based type merging during LTO streaming

Jan Hubicka hubicka@ucw.cz
Mon Oct 1 13:32:00 GMT 2018


> > I see.  So one possible canonicalization is to make _all_
> > pointer-typed FIELD_DECLs point to incomplete variants since the memory
> > accesses should already have the "proper" access types.  Can you
> > get statistics on that?  Not sure how to get an "incomplete" type
> > though (iff we can simply copy the type and NULL TYPE_FIELDs and
> > TYPE_SIZE and friends) - again I'd do that at FLD time.
> 
> So sth like
> 
>  tp = build_distinct_type_copy (t);
>  TYPE_FIELDS (tp) = NULL_TREE;
>  TYPE_SIZE (tp) = NULL_TREE;
>  TYPE_SIZE_UNIT (tp) = NULL_TREE;
>  tp = type_hash_canon (tp);
> 
> of course we "leak" the original type in used COMPONENT_REFs
> (may also cause some verifier ICEs here if the types mismatch that
> of the FIELD_DECLs) and in aggregate copies, etc.  But I wonder
> how much "unused" unnecessary types we have.  That is, I'd paper
> over the ICEs this causes and not fixup the IL stream at first for
> example.

I had patch to play with this as well, let me see if I can revive it.
One problem here is that we will lose info about ODR violations that happens
through pointers.

Honza



More information about the Gcc-patches mailing list