Turn complete to incomplete types in free_lang_data

Jan Hubicka hubicka@ucw.cz
Tue Oct 30 10:11:00 GMT 2018


> > ... 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.

I was playing with that some time ago, too. Even after freeing original
type we could go via variant list to find first compatible variant and
zap unnecessary variants at the same time.

This confuses warning that can no longer name typedefs and speak
of original types instead.  This is why I am keeping the test for
DECL_NAME to match but translate them to pure IDENTIFIER_NODE.

It was sub 2% change whether or not to save different typedef names
with my oriignal type merging experiment.

Honza



More information about the Gcc-patches mailing list