diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-09 22:49:30 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-09 22:49:30 +0000 |
commit | 4ae20857c0da0cab2fbed33d10d6b4d504aa9862 (patch) | |
tree | dd0cf0d6f5ee79e534f85b6bf4b3b2f75372bd8c /gcc/tree-inline.c | |
parent | 9a6f4ddd99aa5db1bed9cfb733d52515f5e131af (diff) | |
download | gcc-4ae20857c0da0cab2fbed33d10d6b4d504aa9862.tar.gz |
* Makefile.in (passes.o, ipa-inline.o): Add dependencies.
* cgraphbuild.c (build_cgraph_edges): Compute frequencies.
(rebuild_cgraph_edges): Likewise.
* cgraph.c (cgraph_set_call_stmt): Add new argument frequency.
(dump_cgraph_node): Dump frequencies.
(cgraph_clone_edge): Add frequency scales.
(cgraph_clone_node): Add freuqnecy.
* cgraph.h (cgraph_edge): Add freuqnecy argument.
(CGRAPH_FREQ_BASE, CGRAPH_FREQ_MAX): New constants.
(cgraph_create_edge, cgraph_clone_edge, cgraph_clone_node): Update.
* tree-pass.h (TODO_rebuild_frequencies): New constant.
* cgraphunit.c (verify_cgraph_node): Verify frequencies.
(cgraph_copy_node_for_versioning): Update call of cgraph_clone_edge.
(save_inline_function_body): Likewise.
* ipa-inline.c: inluce rtl.h
(cgraph_clone_inlined_nods): Update call of cgraph_clone_node.
(cgraph_edge_badness): Use frequencies.
(cgraph_decide_recursive_inlining): Update clonning.
(cgraph_decide_inlining_of_small_function): Dump frequency.
* predict.c (estimate_bb_frequencies): Export.
* predict.h (estimate_bb_frequencies): Declare.
* tree-inline.c (copy_bb): Watch overflows.
(expand_call_inline): Update call of cgraph_create_edge.
(optimize_inline_calls): Use TODO flags to update frequnecies.
* passes.h: Include predict.h
(init_optimization_passes): Move profile ahead.
(execute_function_todo): Handle TODO_rebuild_frequencies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121780 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 75a0553f72c..d2d9487d367 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -777,8 +777,13 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, int count_scal copy_basic_block = create_basic_block (NULL, (void *) 0, (basic_block) bb->prev_bb->aux); copy_basic_block->count = bb->count * count_scale / REG_BR_PROB_BASE; - copy_basic_block->frequency = (bb->frequency + + /* We are going to rebuild frequencies from scratch. These values have just + small importance to drive canonicalize_loop_headers. */ + copy_basic_block->frequency = ((gcov_type)bb->frequency * frequency_scale / REG_BR_PROB_BASE); + if (copy_basic_block->frequency > BB_FREQ_MAX) + copy_basic_block->frequency = BB_FREQ_MAX; copy_bsi = bsi_start (copy_basic_block); for (bsi = bsi_start (bb); @@ -839,7 +844,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, int count_scal edge = cgraph_edge (id->src_node, orig_stmt); if (edge) cgraph_clone_edge (edge, id->dst_node, stmt, - REG_BR_PROB_BASE, 1, true); + REG_BR_PROB_BASE, 1, edge->frequency, true); break; case CB_CGE_MOVE_CLONES: @@ -2400,8 +2405,14 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data) (incorrect node sharing is most common reason for missing edges. */ gcc_assert (dest->needed || !flag_unit_at_a_time); cgraph_create_edge (id->dst_node, dest, stmt, - bb->count, bb->loop_depth)->inline_failed + bb->count, CGRAPH_FREQ_BASE, + bb->loop_depth)->inline_failed = N_("originally indirect function call not considered for inlining"); + if (dump_file) + { + fprintf (dump_file, "Created new direct edge to %s", + cgraph_node_name (dest)); + } goto egress; } @@ -2808,10 +2819,6 @@ optimize_inline_calls (tree fn) gcc_assert (e->inline_failed); } #endif - /* We need to rescale frequencies again to peak at REG_BR_PROB_BASE - as inlining loops might increase the maximum. */ - if (ENTRY_BLOCK_PTR->count) - counts_to_freqs (); /* We are not going to maintain the cgraph edges up to date. Kill it so it won't confuse us. */ @@ -2830,7 +2837,8 @@ optimize_inline_calls (tree fn) throw and they don't care to proactively update local EH info. This is done later in fixup_cfg pass that also execute the verification. */ return (TODO_update_ssa | TODO_cleanup_cfg - | (gimple_in_ssa_p (cfun) ? TODO_remove_unused_locals : 0)); + | (gimple_in_ssa_p (cfun) ? TODO_remove_unused_locals : 0) + | (profile_status != PROFILE_ABSENT ? TODO_rebuild_frequencies : 0)); } /* FN is a function that has a complete body, and CLONE is a function whose |