summaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-03 22:10:54 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-03 22:10:54 +0000
commitb5f162df408737448da5b842c30688444b53737a (patch)
treefcee55b5f24d9dfb6674c4dbf7fa3c50e5dfb709 /gcc/profile.c
parent26be63dd68356c753b81c031a1fb373cc2fa932e (diff)
downloadgcc-b5f162df408737448da5b842c30688444b53737a.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102717 138bc75d-0d04-0410-961f-82ee72b054a4
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;