diff options
author | spark <spark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-28 18:14:32 +0000 |
---|---|---|
committer | spark <spark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-28 18:14:32 +0000 |
commit | 31434f4ad1530e2a7d54dbba9a94e9fd2469a054 (patch) | |
tree | 171dcca9d608250fae06f8b432066dcd65c03996 /gcc/tree-profile.c | |
parent | f8aa77dcb6256ad61c0942fc161850f6139165c1 (diff) | |
download | gcc-31434f4ad1530e2a7d54dbba9a94e9fd2469a054.tar.gz |
gcc/ChangeLog:
2008-05-28 Seongbae Park <seongbae.park@gmail.com>
* value-prof.c (tree_ic_transform): Print counts.
* tree-profile.c (tree_gen_ic_func_profiler):
Clear __gcov_indreict_call_callee variable
to avoid misattribution of the profile.
gcc/testsuite/ChangeLog:
2008-05-28 Seongbae Park <seongbae.park@gmail.com>
* gcc.dg/tree-prof/ic-misattribution-1.c: New test.
* gcc.dg/tree-prof/ic-misattribution-1a.c: New test.
* lib/profopt.exp (profopt-get-options): Support
dg-additional-sources.
(profopt-execute): Handle additional sources.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136118 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-profile.c')
-rw-r--r-- | gcc/tree-profile.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 7a70cefad19..6121837e496 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -308,7 +308,7 @@ tree_gen_ic_func_profiler (void) edge e; basic_block bb; edge_iterator ei; - tree stmt1; + tree stmt1, stmt2; tree tree_uid, cur_func; if (flag_unit_at_a_time) @@ -321,8 +321,11 @@ tree_gen_ic_func_profiler (void) FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs) { + tree void0; + bb = split_edge (e); bsi = bsi_start (bb); + cur_func = force_gimple_operand_bsi (&bsi, build_addr (current_function_decl, current_function_decl), @@ -335,6 +338,16 @@ tree_gen_ic_func_profiler (void) cur_func, ic_void_ptr_var); bsi_insert_after (&bsi, stmt1, BSI_NEW_STMT); + + gcc_assert (EDGE_COUNT (bb->succs) == 1); + bb = split_edge (EDGE_I (bb->succs, 0)); + bsi = bsi_start (bb); + /* Set __gcov_indirect_call_callee to 0, + so that calls from other modules won't get misattributed + to the last caller of the current callee. */ + void0 = build_int_cst (build_pointer_type (void_type_node), 0); + stmt2 = build_gimple_modify_stmt (ic_void_ptr_var, void0); + bsi_insert_after (&bsi, stmt2, BSI_NEW_STMT); } } |