diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2016-06-05 18:38:12 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2016-06-05 16:38:12 +0000 |
commit | 46f1f3c1c267215d8951674d0d62a5027b870163 (patch) | |
tree | 1f7206ca40f3d1c5e3514f50ca8a134f00bab769 /gcc/cfg.c | |
parent | c1c009833d16ef31784ab6df078722d178758e43 (diff) | |
download | gcc-46f1f3c1c267215d8951674d0d62a5027b870163.tar.gz |
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
Diffstat (limited to 'gcc/cfg.c')
-rw-r--r-- | gcc/cfg.c | 37 |
1 files changed, 24 insertions, 13 deletions
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)) { |