> On Mon, 1 Oct 2018, Jan Hubicka wrote: > > > > > 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. > > How so, if we keep the mangled name of the pointed-to types?
If you have "struct a" which violates ODR rule between units foo and bar, then you need to make difference between struct a *ptr defined in foo and one in bar. If tree merging merges them, we lose this info. It is true that we can ten just declare any structure containing "struct a*" as ODR violating that is probably good enough. honza > > Richard. > > > Honza > > > > > > -- > Richard Biener <rguent...@suse.de> > SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB > 21284 (AG Nuernberg)