This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Stream TREE_TYPE of TYPE_DECLs again


Honza, 

One nit.

On 21 November 2018 19:08:43 CET, Jan Hubicka <hubicka@ucw.cz> wrote:
>> 

>Index: ipa-devirt.c
>===================================================================
>--- ipa-devirt.c	(revision 266334)
>+++ ipa-devirt.c	(working copy)

>@@ -2289,27 +2291,43 @@ dump_type_inheritance_graph (FILE *f)
>	   "%i duplicates overall\n", num_all_types, num_types,
>num_duplicates);
> }
> 
>-/* Save some WPA->ltrans streaming by freeing enum values.  */
>+/* Save some WPA->ltrans streaming by freeing stuff needed only for
>good
>+   ODR warnings.
>+   We free TYPE_VALUES of enums and also make TYPE_DECLs to not point
>back
>+   to the type (which is needed to keep them in the same SCC and
>preserve
>+   location information to output warnings) and subsequently we make
>all
>+   TYPE_DECLS of same assembler name equivalent.  */
> 
> static void
>-free_enum_values ()
>+free_odr_warning_data ()
> {
>-  static bool enum_values_freed = false;
>-  if (enum_values_freed || !flag_wpa || !odr_types_ptr)
>+  static bool odr_data_freed = false;
>+
>+  if (odr_data_freed || !flag_wpa || !odr_types_ptr)
>     return;
>-  enum_values_freed = true;
>-  unsigned int i;
>-  for (i = 0; i < odr_types.length (); i++)
>+
>+  odr_data_freed = true;

First store to odr_data_freed is here. 

>+
>+  for (unsigned int i = 0; i < odr_types.length (); i++)
>     if (odr_types[i])
>       {
>-	if (TREE_CODE (odr_types[i]->type) == ENUMERAL_TYPE)
>-	  TYPE_VALUES (odr_types[i]->type) = NULL;
>+	tree t = odr_types[i]->type;
>+
>+	if (TREE_CODE (t) == ENUMERAL_TYPE)
>+	  TYPE_VALUES (t) = NULL;
>+	TREE_TYPE (TYPE_NAME (t)) = void_type_node;
>+
> 	if (odr_types[i]->types)
>      for (unsigned int j = 0; j < odr_types[i]->types->length (); j++)
>-	    if (TREE_CODE ((*odr_types[i]->types)[j]) == ENUMERAL_TYPE)
>-	      TYPE_VALUES ((*odr_types[i]->types)[j]) = NULL;
>+	    {
>+	      tree td = (*odr_types[i]->types)[j];
>+
>+	      if (TREE_CODE (td) == ENUMERAL_TYPE)
>+	        TYPE_VALUES (td) = NULL;
>+	      TYPE_NAME (td) = TYPE_NAME (t);
>+	    }
>       }
>-  enum_values_freed = true;
>+  odr_data_freed = true;

So please remove this second store.
Thanks,
> }
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]