aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2016-06-05 18:38:12 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2016-06-05 16:38:12 +0000
commit46f1f3c1c267215d8951674d0d62a5027b870163 (patch)
tree1f7206ca40f3d1c5e3514f50ca8a134f00bab769 /gcc
parentc1c009833d16ef31784ab6df078722d178758e43 (diff)
downloadgcc-46f1f3c1c267215d8951674d0d62a5027b870163.zip
gcc-46f1f3c1c267215d8951674d0d62a5027b870163.tar.gz
gcc-46f1f3c1c267215d8951674d0d62a5027b870163.tar.bz2
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')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cfg.c37
2 files changed, 29 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3e3a255..be9848c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-03 Jan Hubicka <hubicka@ucw.cz>
+
+ * cfg.c (check_bb_profile): Do not report mismatched profiles when
+ only edges out of BB are EH edges.
+
2016-06-04 Martin Sebor <msebor@redhat.com>
Marcin BaczyƄski <marbacz@gmail.com>
diff --git a/gcc/cfg.c b/gcc/cfg.c
index fdbdee8..0e31780 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))
{