diff options
author | Jan Hubicka <jh@suse.cz> | 2020-05-22 12:29:19 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-05-22 12:30:14 +0200 |
commit | 47273df0bcdd552385f25049dce71943aac8321e (patch) | |
tree | 20f5b2a2605f1215f1256d9635f44a0a7eb86c15 | |
parent | ab7eca92926fdc1da880120c116a1832fce56a29 (diff) | |
download | gcc-47273df0bcdd552385f25049dce71943aac8321e.zip gcc-47273df0bcdd552385f25049dce71943aac8321e.tar.gz gcc-47273df0bcdd552385f25049dce71943aac8321e.tar.bz2 |
Simplify streaming of SCC components
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
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/lto-streamer-in.c | 17 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 19 |
3 files changed, 23 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c3045a..820240f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 85d0edf..d0532c5 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -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); } } diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 0e17946..09a2e82 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -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. */ |