]> gcc.gnu.org Git - gcc.git/commitdiff
Simplify streaming of SCC components
authorJan Hubicka <jh@suse.cz>
Fri, 22 May 2020 10:29:19 +0000 (12:29 +0200)
committerJan Hubicka <jh@suse.cz>
Fri, 22 May 2020 10:30:14 +0000 (12:30 +0200)
this patch saves few bytes from SCC streaming.  First we stream end markers
that are fully ignored at stream in.
Second I missed streaming of emtry_len in the previous change so it is
pointlessly streamed for LTO_trees. Moreover entry_len is almost always 1
(always during gcc bootstrap) and thus it makes sense to avoid stremaing it
in majority of cases.

gcc/ChangeLog:

2020-05-21  Jan Hubicka  <hubicka@ucw.cz>

* lto-streamer-in.c (lto_read_tree): Do not stream end markers.
(lto_input_scc): Optimize streaming of entry lengths.
* lto-streamer-out.c (lto_write_tree): Do not stream end markers
(DFS::DFS): Optimize stremaing of entry lengths

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

index 0c3045a6005fba72c5262fc7c6c574ccf3eb31b7..820240fc8274635f254337232ce3186ba52883b9 100644 (file)
@@ -1,3 +1,10 @@
+2020-05-22  Jan Hubicka  <hubicka@ucw.cz>
+
+       * lto-streamer-in.c (lto_read_tree): Do not stream end markers.
+       (lto_input_scc): Optimize streaming of entry lengths.
+       * lto-streamer-out.c (lto_write_tree): Do not stream end markers
+       (DFS::DFS): Optimize stremaing of entry lengths
+
 2020-05-22  Richard Biener  <rguenther@suse.de>
 
        PR lto/95190
index 85d0edf49a707f33db73027764145af0707c4abe..d0532c5ac51ab61c87f95ca2a14f825b8d90ee75 100644 (file)
@@ -1417,8 +1417,6 @@ lto_read_tree (class lto_input_block *ib, class data_in *data_in,
 
   lto_read_tree_1 (ib, data_in, result);
 
-  /* end_marker = */ streamer_read_uchar (ib);
-
   return result;
 }
 
@@ -1431,12 +1429,18 @@ hashval_t
 lto_input_scc (class lto_input_block *ib, class data_in *data_in,
               unsigned *len, unsigned *entry_len, bool shared_scc)
 {
-  /* A blob of unnamed tree nodes, fill the cache from it and
-     recurse.  */
   unsigned size = streamer_read_uhwi (ib);
-  hashval_t scc_hash = shared_scc ? streamer_read_uhwi (ib) : 0;
+  hashval_t scc_hash = 0;
   unsigned scc_entry_len = 1;
 
+  if (shared_scc)
+    {
+      if (size & 1)
+       scc_entry_len = streamer_read_uhwi (ib);
+      size /= 2;
+      scc_hash = streamer_read_uhwi (ib);
+    }
+
   if (size == 1)
     {
       enum LTO_tags tag = streamer_read_record_start (ib);
@@ -1447,8 +1451,6 @@ lto_input_scc (class lto_input_block *ib, class data_in *data_in,
       unsigned int first = data_in->reader_cache->nodes.length ();
       tree result;
 
-      scc_entry_len = streamer_read_uhwi (ib);
-
       /* Materialize size trees by reading their headers.  */
       for (unsigned i = 0; i < size; ++i)
        {
@@ -1471,7 +1473,6 @@ lto_input_scc (class lto_input_block *ib, class data_in *data_in,
          result = streamer_tree_cache_get_tree (data_in->reader_cache,
                                                 first + i);
          lto_read_tree_1 (ib, data_in, result);
-         /* end_marker = */ streamer_read_uchar (ib);
        }
     }
 
index 0e1794680434c44d3c77eb0666a0352c4b2d72d7..09a2e827f8ef380fdf4832afb3d613ec55aaff8b 100644 (file)
@@ -473,9 +473,6 @@ lto_write_tree (struct output_block *ob, tree expr, bool ref_p)
   streamer_write_tree_header (ob, expr);
 
   lto_write_tree_1 (ob, expr, ref_p);
-
-  /* Mark the end of EXPR.  */
-  streamer_write_zero (ob);
 }
 
 /* Emit the physical representation of tree node EXPR to output block OB,
@@ -764,7 +761,12 @@ DFS::DFS (struct output_block *ob, tree expr, bool ref_p, bool this_ref_p,
            {
              gcc_checking_assert (ob->section_type == LTO_section_decls);
              streamer_write_record_start (ob, LTO_tree_scc);
-             streamer_write_uhwi (ob, size);
+             /* In wast majority of cases scc_entry_len is 1 and size is small
+                integer.  Use extra bit of size to stream info about
+                exceptions.  */
+             streamer_write_uhwi (ob, size * 2 + (scc_entry_len != 1));
+             if (scc_entry_len != 1)
+               streamer_write_uhwi (ob, scc_entry_len);
              streamer_write_uhwi (ob, scc_hash);
            }
          /* Non-trivial SCCs must be packed to trees blocks so forward
@@ -783,8 +785,6 @@ DFS::DFS (struct output_block *ob, tree expr, bool ref_p, bool this_ref_p,
            lto_output_tree_1 (ob, expr, scc_hash, ref_p, this_ref_p);
          else
            {
-             /* Write the size of the SCC entry candidates.  */
-             streamer_write_uhwi (ob, scc_entry_len);
 
              /* Write all headers and populate the streamer cache.  */
              for (unsigned i = 0; i < size; ++i)
@@ -807,12 +807,7 @@ DFS::DFS (struct output_block *ob, tree expr, bool ref_p, bool this_ref_p,
 
              /* Write the bitpacks and tree references.  */
              for (unsigned i = 0; i < size; ++i)
-               {
-                 lto_write_tree_1 (ob, sccstack[first+i].t, ref_p);
-
-                 /* Mark the end of the tree.  */
-                 streamer_write_zero (ob);
-               }
+               lto_write_tree_1 (ob, sccstack[first+i].t, ref_p);
            }
 
          /* Finally truncate the vector.  */
This page took 0.092441 seconds and 5 git commands to generate.