Commit 46f1f3c1 by Jan Hubicka Committed by Jan Hubicka

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
parent c1c00983
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> 2016-06-04 Martin Sebor <msebor@redhat.com>
Marcin Baczyński <marbacz@gmail.com> Marcin Baczyński <marbacz@gmail.com>
......
...@@ -412,20 +412,31 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags) ...@@ -412,20 +412,31 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags)
if (bb != EXIT_BLOCK_PTR_FOR_FN (fun)) if (bb != EXIT_BLOCK_PTR_FOR_FN (fun))
{ {
bool found = false;
FOR_EACH_EDGE (e, ei, bb->succs) FOR_EACH_EDGE (e, ei, bb->succs)
sum += e->probability; {
if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100) if (!(e->flags & EDGE_EH))
fprintf (file, "%s%sInvalid sum of outgoing probabilities %.1f%%\n", found = true;
(flags & TDF_COMMENT) ? ";; " : "", s_indent, sum += e->probability;
sum * 100.0 / REG_BR_PROB_BASE); }
lsum = 0; /* Only report mismatches for non-EH control flow. If there are only EH
FOR_EACH_EDGE (e, ei, bb->succs) edges it means that the BB ends by noreturn call. Here the control
lsum += e->count; flow may just terminate. */
if (EDGE_COUNT (bb->succs) if (found)
&& (lsum - bb->count > 100 || lsum - bb->count < -100)) {
fprintf (file, "%s%sInvalid sum of outgoing counts %i, should be %i\n", if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100)
(flags & TDF_COMMENT) ? ";; " : "", s_indent, fprintf (file, "%s%sInvalid sum of outgoing probabilities %.1f%%\n",
(int) lsum, (int) bb->count); (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)) if (bb != ENTRY_BLOCK_PTR_FOR_FN (fun))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment