diff mbox series

Do not stream TYPE_VALUES to ltrans units

Message ID 20180910132801.GC2084@kam.mff.cuni.cz
State New
Headers show
Series Do not stream TYPE_VALUES to ltrans units | expand

Commit Message

Jan Hubicka Sept. 10, 2018, 1:28 p.m. UTC
Hi,
TYPE_VALUES are currently only used to output warnings on ODR mismatched enums.
I think those warnings are useful and thus we want to stream them to WPA, but
there is no need to stream them further to ltrans units.

Bootstrapped/regtested x86_64-linux, OK?

	* tree-streamer-out.c (write_ts_type_non_common_tree_pointers):
	Do not stream TYPE_VALUES to ltrans units.
	* lto-streamer-out.c (DFS::DFS_write_tree_body): Likewise.

Comments

Richard Biener Sept. 12, 2018, 2:32 p.m. UTC | #1
On Mon, 10 Sep 2018, Jan Hubicka wrote:

> Hi,
> TYPE_VALUES are currently only used to output warnings on ODR mismatched enums.
> I think those warnings are useful and thus we want to stream them to WPA, but
> there is no need to stream them further to ltrans units.
> 
> Bootstrapped/regtested x86_64-linux, OK?

OK.

Richard.

> 	* tree-streamer-out.c (write_ts_type_non_common_tree_pointers):
> 	Do not stream TYPE_VALUES to ltrans units.
> 	* lto-streamer-out.c (DFS::DFS_write_tree_body): Likewise.
> Index: tree-streamer-out.c
> ===================================================================
> --- tree-streamer-out.c	(revision 264180)
> +++ tree-streamer-out.c	(working copy)
> @@ -700,7 +700,9 @@ write_ts_type_non_common_tree_pointers (
>  					bool ref_p)
>  {
>    if (TREE_CODE (expr) == ENUMERAL_TYPE)
> -    stream_write_tree (ob, TYPE_VALUES (expr), ref_p);
> +    /* At WPA time we do not need to stream type values; those are only needed
> +       to output ODR warnings.  */
> +    stream_write_tree (ob, flag_wpa ? NULL : TYPE_VALUES (expr), ref_p);
>    else if (TREE_CODE (expr) == ARRAY_TYPE)
>      stream_write_tree (ob, TYPE_DOMAIN (expr), ref_p);
>    else if (RECORD_OR_UNION_TYPE_P (expr))
> Index: lto-streamer-out.c
> ===================================================================
> --- lto-streamer-out.c	(revision 264180)
> +++ lto-streamer-out.c	(working copy)
> @@ -864,7 +992,9 @@ DFS::DFS_write_tree_body (struct output_
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
>      {
> -      if (TREE_CODE (expr) == ENUMERAL_TYPE)
> +      /* At WPA time we do not need to stream type values; those are only needed
> +         to output ODR warnings.  */
> +      if (TREE_CODE (expr) == ENUMERAL_TYPE && !flag_wpa)
>  	DFS_follow_tree_edge (TYPE_VALUES (expr));
>        else if (TREE_CODE (expr) == ARRAY_TYPE)
>  	DFS_follow_tree_edge (TYPE_DOMAIN (expr));
> 
>
diff mbox series

Patch

Index: tree-streamer-out.c
===================================================================
--- tree-streamer-out.c	(revision 264180)
+++ tree-streamer-out.c	(working copy)
@@ -700,7 +700,9 @@  write_ts_type_non_common_tree_pointers (
 					bool ref_p)
 {
   if (TREE_CODE (expr) == ENUMERAL_TYPE)
-    stream_write_tree (ob, TYPE_VALUES (expr), ref_p);
+    /* At WPA time we do not need to stream type values; those are only needed
+       to output ODR warnings.  */
+    stream_write_tree (ob, flag_wpa ? NULL : TYPE_VALUES (expr), ref_p);
   else if (TREE_CODE (expr) == ARRAY_TYPE)
     stream_write_tree (ob, TYPE_DOMAIN (expr), ref_p);
   else if (RECORD_OR_UNION_TYPE_P (expr))
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c	(revision 264180)
+++ lto-streamer-out.c	(working copy)
@@ -864,7 +992,9 @@  DFS::DFS_write_tree_body (struct output_
 
   if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
     {
-      if (TREE_CODE (expr) == ENUMERAL_TYPE)
+      /* At WPA time we do not need to stream type values; those are only needed
+         to output ODR warnings.  */
+      if (TREE_CODE (expr) == ENUMERAL_TYPE && !flag_wpa)
 	DFS_follow_tree_edge (TYPE_VALUES (expr));
       else if (TREE_CODE (expr) == ARRAY_TYPE)
 	DFS_follow_tree_edge (TYPE_DOMAIN (expr));