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 <seongbae.park@gmail.com>2008-05-28 18:14:32 +0000
commite31e2ae8a9abc342ee7b3cb1cde64ccdc1496998 (patch)
tree171dcca9d608250fae06f8b432066dcd65c03996 /gcc/tree-profile.c
parentd91a43b211be54b1bca02f2eaace9cbdf042793f (diff)
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: https://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.c15
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);
}
}