From: Jan Hubicka Date: Sun, 5 Jun 2016 16:38:12 +0000 (+0200) Subject: cfg.c (check_bb_profile): Do not report mismatched profiles when only edges out of... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46f1f3c1c267215d8951674d0d62a5027b870163;p=gcc.git cfg.c (check_bb_profile): Do not report mismatched profiles when only edges out of BB are EH edges. * cfg.c (check_bb_profile): Do not report mismatched profiles when only edges out of BB are EH edges. From-SVN: r237102 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3e3a2553944..be9848c513d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-03 Jan Hubicka + + * cfg.c (check_bb_profile): Do not report mismatched profiles when + only edges out of BB are EH edges. + 2016-06-04 Martin Sebor Marcin Baczyński diff --git a/gcc/cfg.c b/gcc/cfg.c index fdbdee8113f..0e317809f4c 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -412,20 +412,31 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags) if (bb != EXIT_BLOCK_PTR_FOR_FN (fun)) { + bool found = false; FOR_EACH_EDGE (e, ei, bb->succs) - sum += e->probability; - if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100) - fprintf (file, "%s%sInvalid sum of outgoing probabilities %.1f%%\n", - (flags & TDF_COMMENT) ? ";; " : "", s_indent, - sum * 100.0 / REG_BR_PROB_BASE); - lsum = 0; - FOR_EACH_EDGE (e, ei, bb->succs) - lsum += e->count; - if (EDGE_COUNT (bb->succs) - && (lsum - bb->count > 100 || lsum - bb->count < -100)) - fprintf (file, "%s%sInvalid sum of outgoing counts %i, should be %i\n", - (flags & TDF_COMMENT) ? ";; " : "", s_indent, - (int) lsum, (int) bb->count); + { + if (!(e->flags & EDGE_EH)) + found = true; + sum += e->probability; + } + /* Only report mismatches for non-EH control flow. If there are only EH + edges it means that the BB ends by noreturn call. Here the control + flow may just terminate. */ + if (found) + { + if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100) + fprintf (file, "%s%sInvalid sum of outgoing probabilities %.1f%%\n", + (flags & TDF_COMMENT) ? ";; " : "", s_indent, + sum * 100.0 / REG_BR_PROB_BASE); + lsum = 0; + FOR_EACH_EDGE (e, ei, bb->succs) + lsum += e->count; + if (EDGE_COUNT (bb->succs) + && (lsum - bb->count > 100 || lsum - bb->count < -100)) + fprintf (file, "%s%sInvalid sum of outgoing counts %i, should be %i\n", + (flags & TDF_COMMENT) ? ";; " : "", s_indent, + (int) lsum, (int) bb->count); + } } if (bb != ENTRY_BLOCK_PTR_FOR_FN (fun)) {