Walk pointer_to and reference_to chain in free_lang_data

Richard Biener rguenther@suse.de
Wed Aug 22 07:11:00 GMT 2018


On Tue, 21 Aug 2018, Jan Hubicka wrote:

> Hi,
> extra sanity checking I am going to send in followup patch noticed that we
> stream pointer types that was never seen by free_lang_data.  This is because
> they are referenced by TYPE_POINTER_TO list and are inserted into the gimple
> statements later when we wrap everything in MEM_REF (by make_pointer_type).
> 
> Bootstrapped/regtested x86_64-linux, OK?

Hmm, but make_pointer_type might as well create new pointer types
that didn't exist before - shouldn't those have the same problem
(which actually is?)?  Note the pointed-to types are already in the IL,
so another option would be to create (and walk) the pointer types
under the same circumstance as streaming creates them when walking the
IL.  Note that new pointer types can be created between free-lang-data
and streaming anyways ...

So again - what's the real reason?  I bet the sanity checking might
trip over late creation of pointer-types so I'd rather fix the
sanity checking and only check the pointed-to types were visited?

Richard.

> Honza
> 
> 	* tree.c (find_decls_types_r): Walk also TYPE_NEXT_PTR_TO and
> 	TYPE_NEXT_REF_TO.
> Index: tree.c
> ===================================================================
> --- tree.c	(revision 263699)
> +++ tree.c	(working copy)
> @@ -5525,9 +5525,14 @@ find_decls_types_r (tree *tp, int *ws, v
>        fld_worklist_push (TYPE_POINTER_TO (t), fld);
>        fld_worklist_push (TYPE_REFERENCE_TO (t), fld);
>        fld_worklist_push (TYPE_NAME (t), fld);
> -      /* Do not walk TYPE_NEXT_PTR_TO or TYPE_NEXT_REF_TO.  We do not stream
> -	 them and thus do not and want not to reach unused pointer types
> -	 this way.  */
> +      /* While we do not stream TYPE_POINTER_TO and TYPE_REFERENCE_TO
> +	 lists, we may look types up in these lists and use them while
> +	 optimizing the function body.  Thus we need to free lang data
> +	 in them.  */
> +      if (TREE_CODE (t) == POINTER_TYPE)
> +        fld_worklist_push (TYPE_NEXT_PTR_TO (t), fld);
> +      if (TREE_CODE (t) == REFERENCE_TYPE)
> +        fld_worklist_push (TYPE_NEXT_REF_TO (t), fld);
>        if (!POINTER_TYPE_P (t))
>  	fld_worklist_push (TYPE_MIN_VALUE_RAW (t), fld);
>        /* TYPE_MAX_VALUE_RAW is TYPE_BINFO for record types.  */
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)



More information about the Gcc-patches mailing list