Do not stream redundant stuff
authorJan Hubicka <jh@suse.cz>
Mon, 25 May 2020 12:41:33 +0000 (14:41 +0200)
committerJan Hubicka <jh@suse.cz>
Mon, 25 May 2020 12:41:33 +0000 (14:41 +0200)
as discussed on IRC this adds knob to disable stuff we stream "just for fun"
(or to make it easier to debug streamer desychnonization).

Te size of .o files in gcc subdirectory is reduced form 506MB to 492MB

gcc/

* lto-streamer-out.c (lto_output_tree): Add streamer_debugging check.
* lto-streamer.h (streamer_debugging): New constant
* tree-streamer-in.c (streamer_read_tree_bitfields): Add
streamer_debugging check.
(streamer_get_pickled_tree): Likewise.
* tree-streamer-out.c (pack_ts_base_value_fields): Likewise.

gcc/ChangeLog
gcc/lto-streamer-out.c
gcc/lto-streamer.h
gcc/tree-streamer-in.c
gcc/tree-streamer-out.c

index d5844590274d416403796a979635d192f91a5af0..a83cc4ba1c7f4e0b736b6889629ddb2d3f45fb08 100644 (file)
@@ -1,3 +1,12 @@
+2020-05-25  Jan Hubicka  <hubicka@ucw.cz>
+
+       * lto-streamer-out.c (lto_output_tree): Add streamer_debugging check.
+       * lto-streamer.h (streamer_debugging): New constant
+       * tree-streamer-in.c (streamer_read_tree_bitfields): Add
+       streamer_debugging check.
+       (streamer_get_pickled_tree): Likewise.
+       * tree-streamer-out.c (pack_ts_base_value_fields): Likewise.
+
 2020-05-25  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/95308
index 887a51d3eaeb5b86e91c5b33528ca488ffe2368e..288e3c0f4c6f1643343a385dc30df98e74e7d33a 100644 (file)
@@ -1748,8 +1748,9 @@ lto_output_tree (struct output_block *ob, tree expr,
         will instantiate two different nodes for the same object.  */
       streamer_write_record_start (ob, LTO_tree_pickle_reference);
       streamer_write_uhwi (ob, ix);
-      streamer_write_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS,
-                          lto_tree_code_to_tag (TREE_CODE (expr)));
+      if (streamer_debugging)
+       streamer_write_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS,
+                            lto_tree_code_to_tag (TREE_CODE (expr)));
       lto_stats.num_pickle_refs_output++;
     }
   else
index a466fb8b329e94c08f8e8e2a50b5b2490b153b76..93da3c66fd89524c57cbdfca41c8b8d4a1394ef0 100644 (file)
@@ -125,6 +125,9 @@ along with GCC; see the file COPYING3.  If not see
 
 typedef unsigned char  lto_decl_flags_t;
 
+/* Stream additional data to LTO object files to make it easier to debug
+   streaming code.  This changes object files.  */
+static const bool streamer_debugging = false;
 
 /* Tags representing the various IL objects written to the bytecode file
    (GIMPLE statements, basic blocks, EH regions, tree nodes, etc).
index 450f40d58d3917c5e1d577871219c69f928bafef..d2e45e335547325bee22bde24c74b909d746aecd 100644 (file)
@@ -487,9 +487,13 @@ streamer_read_tree_bitfields (class lto_input_block *ib,
 
   /* The first word in BP contains the code of the tree that we
      are about to read.  */
-  code = (enum tree_code) bp_unpack_value (&bp, 16);
-  lto_tag_check (lto_tree_code_to_tag (code),
-                lto_tree_code_to_tag (TREE_CODE (expr)));
+  if (streamer_debugging)
+    {
+      code = (enum tree_code) bp_unpack_value (&bp, 16);
+      lto_tag_check (lto_tree_code_to_tag (code),
+                    lto_tree_code_to_tag (TREE_CODE (expr)));
+    }
+  code = TREE_CODE (expr);
 
   /* Note that all these functions are highly sensitive to changes in
      the types and sizes of each of the fields being packed.  */
@@ -1107,11 +1111,14 @@ streamer_get_pickled_tree (class lto_input_block *ib, class data_in *data_in)
   enum LTO_tags expected_tag;
 
   ix = streamer_read_uhwi (ib);
-  expected_tag = streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS);
-
   result = streamer_tree_cache_get_tree (data_in->reader_cache, ix);
-  gcc_assert (result
-              && TREE_CODE (result) == lto_tag_to_tree_code (expected_tag));
+
+  if (streamer_debugging)
+    {
+      expected_tag = streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS);
+      gcc_assert (result
+                 && TREE_CODE (result) == lto_tag_to_tree_code (expected_tag));
+    }
 
   return result;
 }
index 4e8a12c71e6322a016a8e3c750b9d94cfd2fb0cb..94635c4a8aecf6e4370b0a306c3f670a942a856a 100644 (file)
@@ -71,7 +71,8 @@ write_identifier (struct output_block *ob,
 static inline void
 pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
 {
-  bp_pack_value (bp, TREE_CODE (expr), 16);
+  if (streamer_debugging)
+    bp_pack_value (bp, TREE_CODE (expr), 16);
   if (!TYPE_P (expr))
     {
       bp_pack_value (bp, TREE_SIDE_EFFECTS (expr), 1);