Make LABLE_DECLs mostly non-indexable

Message ID
State New
Headers show
  • Make LABLE_DECLs mostly non-indexable
Related show

Commit Message

Jan Hubicka June 24, 2018, 2:13 p.m.
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.


	* 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)
       && 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