summaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2005-08-04 00:10:54 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2005-08-03 22:10:54 +0000
commitd783b2a2dc91e1d2c1fea78cac2b6c6c73b3680d (patch)
treefcee55b5f24d9dfb6674c4dbf7fa3c50e5dfb709 /gcc/profile.c
parent5336645054c5bc4bf56215863b9d64bd24884f32 (diff)
downloadgcc-d783b2a2dc91e1d2c1fea78cac2b6c6c73b3680d.tar.gz
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
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index 95448f076ff..1fc8aa58d50 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -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;