This optimizes streaming of DECL_DEBUG_EXPR to only when necessary.

LTO bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2018-01-12  Richard Biener  <rguent...@suse.de>

        * lto-streamer-out.c (DFS::DFS_write_tree_body): Process
        DECL_DEBUG_EXPR conditional on DECL_HAS_DEBUG_EXPR_P.
        * tree-streamer-in.c (lto_input_ts_decl_common_tree_pointers):
        Likewise.
        * tree-streamer-out.c (write_ts_decl_common_tree_pointers): Likewise.

Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c      (revision 256535)
+++ gcc/lto-streamer-out.c      (working copy)
@@ -802,7 +802,8 @@ DFS::DFS_write_tree_body (struct output_
           || TREE_CODE (expr) == PARM_DECL)
          && DECL_HAS_VALUE_EXPR_P (expr))
        DFS_follow_tree_edge (DECL_VALUE_EXPR (expr));
-      if (VAR_P (expr))
+      if (VAR_P (expr)
+         && DECL_HAS_DEBUG_EXPR_P (expr))
        DFS_follow_tree_edge (DECL_DEBUG_EXPR (expr));
     }
 
Index: gcc/tree-streamer-in.c
===================================================================
--- gcc/tree-streamer-in.c      (revision 256535)
+++ gcc/tree-streamer-in.c      (working copy)
@@ -714,7 +714,8 @@ lto_input_ts_decl_common_tree_pointers (
       && DECL_HAS_VALUE_EXPR_P (expr))
     SET_DECL_VALUE_EXPR (expr, stream_read_tree (ib, data_in));
 
-  if (VAR_P (expr))
+  if (VAR_P (expr)
+      && DECL_HAS_DEBUG_EXPR_P (expr))
     {
       tree dexpr = stream_read_tree (ib, data_in);
       if (dexpr)
Index: gcc/tree-streamer-out.c
===================================================================
--- gcc/tree-streamer-out.c     (revision 256535)
+++ gcc/tree-streamer-out.c     (working copy)
@@ -609,7 +609,8 @@ write_ts_decl_common_tree_pointers (stru
       && DECL_HAS_VALUE_EXPR_P (expr))
     stream_write_tree (ob, DECL_VALUE_EXPR (expr), ref_p);
 
-  if (VAR_P (expr))
+  if (VAR_P (expr)
+      && DECL_HAS_DEBUG_EXPR_P (expr))
     stream_write_tree (ob, DECL_DEBUG_EXPR (expr), ref_p);
 }
 

Reply via email to