Make LABLE_DECLs mostly non-indexable

Message ID 20180624141332.GA11500@kam.mff.cuni.cz
State New
Headers show
Series
  • Make LABLE_DECLs mostly non-indexable
Related show

Commit Message

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

Patch

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