Turn complete to incomplete types in free_lang_data

Richard Biener rguenther@suse.de
Tue Oct 30 09:42:00 GMT 2018


On Fri, 26 Oct 2018, Jan Hubicka wrote:

> > > OK if it survives more testing on firefox and lto bootstrap?
> > 
> > It looks like a hack to do free_lang_data_in_type from free_lang_data_in_decl
> > walk - I remember you wanted to unify find_* and free_*?  If not doing that
> 
> I did try it :) There is a catch - free lang data calls langhooks to produce mangled
> assembler names. For that the trees must be non-freed yet.
> So you can't do freeing as you discover what trees to follow.
> 
> We can save one walk by computing assembler names during the discovery, but we
> need to know all trees we want to do langhooks on before we start putting NULL
> pointers around.
> 
> > why would first doing the type walk and only then the decl walk not work
> > to avoid this ugliness?
> 
> Hmm, currently we first walk decl and then types,so swapping them woudl work.
> But since I want to also simplify types in function types, it would break next.
> 
> > 
> > That we need to have variants of the incomplete types at all for the place
> > you substitute them (FIELD_DECLs) has what reason?  See also comments below...
> > 
> > We are getting more and more "interesting" in things we free.  _Please_ work on
> > enabling free-lang-data (portions) for all compilations (with
> > -fchecking?).  It's disturbing to see
> > so much differences creep in in the supposedly "shared" part of regular and
> > LTO compilation.
> 
> I wonder what is the plan to make late warnings to work reliably in this case?

Well - late warnings are a red herring.  And we have caret locations 
citing source.  And we could look into the DWARF (well, not from lto1,
but there it's "broken" already anyways)

> > > +/* Do same comparsion as check_qualified_type skipping lang part of type
> > > +   and be more permissive about type names: we only care that names are
> > > +   same (for diagnostics) and that ODR names are the same.  */
> > > +
> > > +static bool
> > > +types_equal_p (tree t, tree v)
> > 
> > The function name is of course totally misleading.  Please use sth like
> > fld_type_variants_equal_p.
> > 
> > Note we already split check_qualified_type - can't you somehow re-use
> > check_base_type (only)?
> 
> Hmm, you are right. I can re-unify those since this function basically cared
> about ...
> > 
> > > +{
> > > +  if (t==v)
> > > +    return true;
> > > +
> > > +  if (TYPE_QUALS (t) != TYPE_QUALS (v))
> > > +    return false;
> > > +
> > > +  if (TYPE_NAME (t) != TYPE_NAME (v)
> > > +      && (!TYPE_NAME (t) || !TYPE_NAME (v)
> > > +         || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL
> > > +         || TREE_CODE (TYPE_NAME (v)) != TYPE_DECL
> > > +         || DECL_ASSEMBLER_NAME_RAW (TYPE_NAME (t))
> > > +            != DECL_ASSEMBLER_NAME_RAW (TYPE_NAME (v))
> > 
> > I wonder what this is about...
> 
> ... unmerged TYPE_NAMEs which happens only on WPA state. It is leftover of
> my merging during streaming experiment.
> 
> I will clean this up and send updated patch.  I was bit in hurry leaving today
> and wanted to send at least initial patch for discussion.

OK, btw I noticed that we simply do

      DECL_ORIGINAL_TYPE (decl) = NULL_TREE;

on TYPE_DECLs.  But the bigger benefit would be dropping the typedef
variants completely by doing

  if (TREE_CODE (TYPE_NAME (TREE_TYPE (t))) == TYPE_DECL
      && DECL_ORIGINAL_TYPE (TYPE_NAME (TREE_TYPE (t))))
    TREE_TYPE (t) = DECL_ORIGINAL_TYPE (TYPE_NAME (TREE_TYPE (t)));

for all type references.  That should get rid of most TYPE_DECLs
(the DECL_ORIGINAL_TYPE has no name IIRC).

Simply NULLing DECL_ORIGINAL_TYPE on TYPE_DECLs will make this
impossible.

Richard.



More information about the Gcc-patches mailing list