aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-in.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-12-04 20:35:23 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2010-12-04 19:35:23 +0000
commitdb0bf14f6b2ae9e3a1581522a9c4b90ac5453a06 (patch)
treeb3887b2fc44cec55b580768f354ae76eeb37fa87 /gcc/lto-streamer-in.c
parentf3007348c3fdb811969f942a6b3466f372067fda (diff)
downloadgcc-db0bf14f6b2ae9e3a1581522a9c4b90ac5453a06.zip
gcc-db0bf14f6b2ae9e3a1581522a9c4b90ac5453a06.tar.gz
gcc-db0bf14f6b2ae9e3a1581522a9c4b90ac5453a06.tar.bz2
re PR driver/46760 (LTO bootstrap doesn't work with FDO)
PR tree-optimization/46760 * cgraph.c (cgraph_create_node): Initialize count_materialization_scale. * cgraph.h (struct cgraph_node): Add count_materialization_scale. * lto-cgraph.c (lto_output_edge): Fix assert. (lto_output_node): Output count_materialization_scale. (output_profile_summary): Output only runs and sum_max. (input_node): Input count_materialization_scale. (input_profile_summary): Read data into file specific gcov summary. (merge_profile_summaries): New function. (input_cgraph): Update call of input_profile_summary; call merge_profile_summaries. * lto-streamer-in.c (input_cfg): Add count_materialization_scale arg; rescale counts at read in. (intput_bb): Likewise. (input_function): Update call of input_bb. (lto_read_body): Update call of input_cfg. * lto-streamer.h: Inlclude gcov-io.h (lto_file_decl_data): Add gcov_ctr_summary. From-SVN: r167458
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r--gcc/lto-streamer-in.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index f167d40..fb20144 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -719,7 +719,8 @@ make_new_block (struct function *fn, unsigned int index)
/* Read the CFG for function FN from input block IB. */
static void
-input_cfg (struct lto_input_block *ib, struct function *fn)
+input_cfg (struct lto_input_block *ib, struct function *fn,
+ int count_materialization_scale)
{
unsigned int bb_count;
basic_block p_bb;
@@ -752,7 +753,8 @@ input_cfg (struct lto_input_block *ib, struct function *fn)
if (bb == NULL)
bb = make_new_block (fn, index);
- edge_count = lto_input_uleb128 (ib);
+ edge_count = (lto_input_uleb128 (ib) * count_materialization_scale
+ + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
/* Connect up the CFG. */
for (i = 0; i < edge_count; i++)
@@ -1066,7 +1068,8 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
static void
input_bb (struct lto_input_block *ib, enum LTO_tags tag,
- struct data_in *data_in, struct function *fn)
+ struct data_in *data_in, struct function *fn,
+ int count_materialization_scale)
{
unsigned int index;
basic_block bb;
@@ -1079,7 +1082,8 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
index = lto_input_uleb128 (ib);
bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
- bb->count = lto_input_sleb128 (ib);
+ bb->count = (lto_input_sleb128 (ib) * count_materialization_scale
+ + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
bb->loop_depth = lto_input_sleb128 (ib);
bb->frequency = lto_input_sleb128 (ib);
bb->flags = lto_input_sleb128 (ib);
@@ -1253,12 +1257,14 @@ input_function (tree fn_decl, struct data_in *data_in,
DECL_INITIAL (fn_decl) = lto_input_tree (ib, data_in);
gcc_assert (DECL_INITIAL (fn_decl));
DECL_SAVED_TREE (fn_decl) = NULL_TREE;
+ node = cgraph_node (fn_decl);
/* Read all the basic blocks. */
tag = input_record_start (ib);
while (tag)
{
- input_bb (ib, tag, data_in, fn);
+ input_bb (ib, tag, data_in, fn,
+ node->count_materialization_scale);
tag = input_record_start (ib);
}
@@ -1300,7 +1306,6 @@ input_function (tree fn_decl, struct data_in *data_in,
gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest));
}
- node = cgraph_node (fn_decl);
fixup_call_stmt_edges (node, stmts);
execute_all_ipa_stmt_fixups (node, stmts);
@@ -1393,6 +1398,7 @@ lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl,
{
struct function *fn = DECL_STRUCT_FUNCTION (fn_decl);
struct lto_in_decl_state *decl_state;
+ struct cgraph_node *node = cgraph_node (fn_decl);
push_cfun (fn);
init_tree_ssa (fn);
@@ -1402,7 +1408,7 @@ lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl,
gcc_assert (decl_state);
file_data->current_decl_state = decl_state;
- input_cfg (&ib_cfg, fn);
+ input_cfg (&ib_cfg, fn, node->count_materialization_scale);
/* Set up the struct function. */
input_function (fn_decl, data_in, &ib_main);