From d783b2a2dc91e1d2c1fea78cac2b6c6c73b3680d Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 4 Aug 2005 00:10:54 +0200 Subject: 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 --- gcc/profile.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/profile.c') diff --git a/gcc/profile.c b/gcc/profile.c index 95448f0..1fc8aa5 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; -- cgit v1.1