profile.c (branch_prob): Split edges with goto locus on them to get proper line counts.

* profile.c (branch_prob): Split edges with goto locus on them
	to get proper line counts.
	* tree-cfg.c (make_cond_expr_edges): Record user goto locuses, if any.

	* gcov-1.C: Fix switch counts.
	* gcov-4b.c: Likewise.

From-SVN: r102717
This commit is contained in:
Jan Hubicka 2005-08-04 00:10:54 +02:00 committed by Jan Hubicka
parent 5336645054
commit d783b2a2dc
6 changed files with 50 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2005-08-04 Jan Hubicka <jh@suse.cz>
* profile.c (branch_prob): Split edges with goto locus on them
to get proper line counts.
* tree-cfg.c (make_cond_expr_edges): Record user goto locuses, if any.
2005-08-03 Paul Brook <paul@codesourcery.com>
* function.c (assign_parms): Round current_function_args_size

View File

@ -806,6 +806,27 @@ branch_prob (void)
FOR_EACH_EDGE (e, ei, bb->succs)
{
tree last = last_stmt (bb);
/* Edge with goto locus might get wrong coverage info unless
it is the only edge out of BB.
Don't do that when the locuses match, so
if (blah) goto something;
is not computed twice. */
if (e->goto_locus && !single_succ_p (bb)
#ifdef USE_MAPPED_LOCATION
&& (LOCATION_FILE (e->goto_locus)
!= LOCATION_FILE (EXPR_LOCATION (last))
|| (LOCATION_LINE (e->goto_locus)
!= LOCATION_LINE (EXPR_LOCATION (last)))))
#else
&& (e->goto_locus->file != EXPR_LOCUS (last)->file
|| (e->goto_locus->line
!= EXPR_LOCUS (last)->line)))
#endif
{
basic_block new = split_edge (e);
single_succ_edge (new)->goto_locus = e->goto_locus;
}
if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL))
&& e->dest != EXIT_BLOCK_PTR)
need_exit_edge = 1;

View File

@ -1,3 +1,8 @@
2005-08-04 Jan Hubicka <jh@suse.cz>
* gcov-1.C: Fix switch counts.
* gcov-4b.c: Likewise.
2005-08-03 Jeff Law <law@redhat.com>
* g++.dg/tree-ssa/pr14814.C: xfail test for &this count.

View File

@ -253,7 +253,7 @@ test_switch (int i, int j)
{
int result = 0; /* count(5) */
/* branch(80 25) */
/* branch(20 0 60 20) */
switch (i) /* count(5) */
/* branch(end) */
{

View File

@ -207,7 +207,7 @@ test_switch (int i, int j)
{
int result = 0;
switch (i) /* branch(80 25) */
switch (i) /* branch(20 0 60 20) */
/* branch(end) */
{
case 1:

View File

@ -577,6 +577,7 @@ make_cond_expr_edges (basic_block bb)
tree entry = last_stmt (bb);
basic_block then_bb, else_bb;
tree then_label, else_label;
edge e;
gcc_assert (entry);
gcc_assert (TREE_CODE (entry) == COND_EXPR);
@ -587,8 +588,21 @@ make_cond_expr_edges (basic_block bb)
then_bb = label_to_block (then_label);
else_bb = label_to_block (else_label);
make_edge (bb, then_bb, EDGE_TRUE_VALUE);
make_edge (bb, else_bb, EDGE_FALSE_VALUE);
e = make_edge (bb, then_bb, EDGE_TRUE_VALUE);
#ifdef USE_MAPPED_LOCATION
e->goto_locus = EXPR_LOCATION (COND_EXPR_THEN (entry));
#else
e->goto_locus = EXPR_LOCUS (COND_EXPR_THEN (entry));
#endif
e = make_edge (bb, else_bb, EDGE_FALSE_VALUE);
if (e)
{
#ifdef USE_MAPPED_LOCATION
e->goto_locus = EXPR_LOCATION (COND_EXPR_ELSE (entry));
#else
e->goto_locus = EXPR_LOCUS (COND_EXPR_ELSE (entry));
#endif
}
}
/* Hashing routine for EDGE_TO_CASES. */