diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-03-27 07:58:59 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-03-27 06:58:59 +0000 |
commit | eaeec5ecfa45ef6af7642c6bf45c3d77dd4de6b9 (patch) | |
tree | cbd2e935efaa0cca2a297c9acffbbdf68e1c834d /gcc/lto | |
parent | 38147a2a4e7c553840b45ba7d099a5f93ac192a4 (diff) | |
download | gcc-eaeec5ecfa45ef6af7642c6bf45c3d77dd4de6b9.zip gcc-eaeec5ecfa45ef6af7642c6bf45c3d77dd4de6b9.tar.gz gcc-eaeec5ecfa45ef6af7642c6bf45c3d77dd4de6b9.tar.bz2 |
re PR lto/65536 (LTO line number information garbled)
PR lto/65536
* lto-streamer.h (class lto_location_cache): New.
(struct data_in): Add location_cache.
(lto_input_location): Update prototype.
(stream_input_location_now): New.
* streamer-hooks.h (struct streamer_hooks): Make input_location to take
pointer to location.
(stream_input_location): Update.
* ipa-devirt.c: Include streamer-hooks.h and lto-streamer.h
(warn_odr): Apply location cache before warning.
(lto_input_location): Update prototype.
* gimple-streamer-in.c (input_phi, input_gimple_stmt):
Use stream_input_location_now.
* lto/lto.c (unify_scc): Revert location cache when unification
suceeded.
(lto_read_decls): Accept location cache after sucess;
apply location cache before calling debug hooks.
* lto-streamer-in.c (lto_location_cache::current_cache): New static
variable.
(lto_location_cache::cmp_loc): New function.
(lto_location_cache::apply_location_cache): New function.
(lto_location_cache::accept_location_cache): New function.
(lto_location_cache::revert_location_cache): New function.
(lto_location_cache::input_location): New function.
(lto_input_location): Do location caching.
(stream_input_location_now): New function.
(input_eh_region, input_struct_function_base): Use
stream_input_location_now.
(lto_data_in_create): use new.
(lto_data_in_delete): Use delete.
* tree-streamer-in.c (unpack_ts_block_value_fields,
unpack_ts_omp_clause_value_fields, streamer_read_tree_bitfields,
lto_input_ts_exp_tree_pointers): Update for cached location api.
From-SVN: r221720
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/lto/lto.c | 19 |
2 files changed, 24 insertions, 3 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index ae379eb..588b603 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,11 @@ +2015-03-26 Jan Hubicka <hubicka@ucw.cz> + + PR lto/65536 + * lto.c (unify_scc): Revert location cache when unification + suceeded. + (lto_read_decls): Accept location cache after sucess; + apply location cache before calling debug hooks. + 2015-03-10 Jan Hubicka <hubicka@ucw.cz> * lto.c (read_cgraph_and_symbols): Do not do merging diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 760975f..360aeed 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1734,10 +1734,11 @@ cmp_tree (const void *p1_, const void *p2_) that was successful, otherwise return false. */ static bool -unify_scc (struct streamer_tree_cache_d *cache, unsigned from, +unify_scc (struct data_in *data_in, unsigned from, unsigned len, unsigned scc_entry_len, hashval_t scc_hash) { bool unified_p = false; + struct streamer_tree_cache_d *cache = data_in->reader_cache; tree_scc *scc = (tree_scc *) alloca (sizeof (tree_scc) + (len - 1) * sizeof (tree)); scc->next = NULL; @@ -1827,6 +1828,7 @@ unify_scc (struct streamer_tree_cache_d *cache, unsigned from, } /* Free the tree nodes from the read SCC. */ + data_in->location_cache.revert_location_cache (); for (unsigned i = 0; i < len; ++i) { enum tree_code code; @@ -1920,10 +1922,14 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data, /* Try to unify the SCC with already existing ones. */ if (!flag_ltrans - && unify_scc (data_in->reader_cache, from, + && unify_scc (data_in, from, len, scc_entry_len, scc_hash)) continue; + /* Tree merging failed, mark entries in location cache as + permanent. */ + data_in->location_cache.accept_location_cache (); + bool seen_type = false; for (unsigned i = 0; i < len; ++i) { @@ -1953,7 +1959,13 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data, /* Register TYPE_DECLs with the debuginfo machinery. */ if (!flag_wpa && TREE_CODE (t) == TYPE_DECL) - debug_hooks->type_decl (t, !DECL_FILE_SCOPE_P (t)); + { + /* Dwarf2out needs location information. + TODO: Moving this out of the streamer loop may noticealy + improve ltrans linemap memory use. */ + data_in->location_cache.apply_location_cache (); + debug_hooks->type_decl (t, !DECL_FILE_SCOPE_P (t)); + } if (!flag_ltrans) { /* Register variables and functions with the @@ -1979,6 +1991,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data, gcc_assert (t && data_in->reader_cache->nodes.length () == from); } } + data_in->location_cache.apply_location_cache (); /* Read in lto_in_decl_state objects. */ data_ptr = (const uint32_t *) ((const char*) data + decl_offset); |