aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-profile.c
diff options
context:
space:
mode:
authorSeongbae Park <seongbae.park@gmail.com>2008-05-28 18:14:32 +0000
committerSeongbae Park <spark@gcc.gnu.org>2008-05-28 18:14:32 +0000
commit3dfb6f59635939b980bbad8a012057d1ec258a50 (patch)
tree171dcca9d608250fae06f8b432066dcd65c03996 /gcc/tree-profile.c
parent5a976da002caf3838a1f986098ce655fb881efb8 (diff)
downloadgcc-3dfb6f59635939b980bbad8a012057d1ec258a50.zip
gcc-3dfb6f59635939b980bbad8a012057d1ec258a50.tar.gz
gcc-3dfb6f59635939b980bbad8a012057d1ec258a50.tar.bz2
value-prof.c (tree_ic_transform): Print counts.
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. From-SVN: r136118
Diffstat (limited to 'gcc/tree-profile.c')
-rw-r--r--gcc/tree-profile.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 7a70cef..6121837 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);
}
}