summaryrefslogtreecommitdiff
path: root/gcc/gimple-streamer-in.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-03-27 07:58:59 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-03-27 06:58:59 +0000
commiteaeec5ecfa45ef6af7642c6bf45c3d77dd4de6b9 (patch)
treecbd2e935efaa0cca2a297c9acffbbdf68e1c834d /gcc/gimple-streamer-in.c
parent38147a2a4e7c553840b45ba7d099a5f93ac192a4 (diff)
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/gimple-streamer-in.c')
-rw-r--r--gcc/gimple-streamer-in.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index da670b89406..eef076634ec 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -87,7 +87,9 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
tree def = stream_read_tree (ib, data_in);
int src_index = streamer_read_uhwi (ib);
bitpack_d bp = streamer_read_bitpack (ib);
- location_t arg_loc = stream_input_location (&bp, data_in);
+ /* Do not cache a location - we do not have API to get pointer to the
+ location in PHI statement and we may trigger reallocation. */
+ location_t arg_loc = stream_input_location_now (&bp, data_in);
basic_block sbb = BASIC_BLOCK_FOR_FN (fn, src_index);
edge e = NULL;
@@ -134,8 +136,9 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
has_hist = bp_unpack_value (&bp, 1);
stmt->subcode = bp_unpack_var_len_unsigned (&bp);
- /* Read location information. */
- gimple_set_location (stmt, stream_input_location (&bp, data_in));
+ /* Read location information. Caching here makes no sense until streamer
+ cache can handle the following gimple_set_block. */
+ gimple_set_location (stmt, stream_input_location_now (&bp, data_in));
/* Read lexical block reference. */
gimple_set_block (stmt, stream_read_tree (ib, data_in));