Make LABLE_DECLs mostly non-indexable

Jan Hubicka hubicka@ucw.cz
Sun Jun 24 14:13:00 GMT 2018


Hi,
while looking on the stats of types of nodes streamed into global stream I notied
that we stream all label decls globally.  This is quite obvious omision and we
need to keep indexable only those that can cross function boundary.

While doing so i also noticed special handling of IMPORTED_DECL that is unnecesary.
I will send patches to drop its streaming incrementally.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

	* lto-streamer-out.c (tree_is_indexable): Make LABEL_DECL nonindexable
	unless it is forced or nonlocal; assert that we stream no IMPORTED_DECL.

Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c	(revision 261885)
+++ lto-streamer-out.c	(working copy)
@@ -134,9 +134,12 @@ tree_is_indexable (tree t)
   if ((TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL)
       && DECL_CONTEXT (t))
     return variably_modified_type_p (TREE_TYPE (DECL_CONTEXT (t)), NULL_TREE);
-  /* IMPORTED_DECL is put into BLOCK and thus it never can be shared.  */
+  /* IMPORTED_DECL is put into BLOCK and thus it never can be shared.
+     We should no longer need to stream it.  */
   else if (TREE_CODE (t) == IMPORTED_DECL)
-    return false;
+    gcc_unreachable ();
+  else if (TREE_CODE (t) == LABEL_DECL)
+    return FORCED_LABEL (t) || DECL_NONLOCAL (t);
   else if (((VAR_P (t) && !TREE_STATIC (t))
 	    || TREE_CODE (t) == TYPE_DECL
 	    || TREE_CODE (t) == CONST_DECL



More information about the Gcc-patches mailing list