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
This commit is contained in:
Jan Hubicka 2016-06-05 18:38:12 +02:00 committed by Jan Hubicka
parent c1c009833d
commit 46f1f3c1c2
2 changed files with 29 additions and 13 deletions

View File

@ -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>

View File

@ -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))
{