+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
lto_read_tree_1 (ib, data_in, result);
- /* end_marker = */ streamer_read_uchar (ib);
-
return result;
}
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);
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)
{
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);
}
}
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,
{
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
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)
/* 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. */