diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-05 17:34:16 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-05 17:34:16 +0000 |
commit | a2e423212fcde0a5659145ea2ac4de626297fc14 (patch) | |
tree | 4c6b7e31c08d36c2ce332bfd0f07dda9240944d1 /gcc/cfg.c | |
parent | c9fc348751f70ebf0e19713529ed9f6bd747da43 (diff) | |
download | gcc-a2e423212fcde0a5659145ea2ac4de626297fc14.tar.gz |
* cfg.c (dump_flow_info): Warn about profile mismatches.
* cfgrtl.c (verify_flow_info): Few aditional sanity checks.
(purge_dead_edges): Remove REG_BR_PROB notes on simplejumps.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50320 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfg.c')
-rw-r--r-- | gcc/cfg.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/gcc/cfg.c b/gcc/cfg.c index a33beffd0b2..433d10accf9 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -505,8 +505,10 @@ dump_flow_info (file) fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges); for (i = 0; i < n_basic_blocks; i++) { - basic_block bb = BASIC_BLOCK (i); + basic_block bb = BASIC_BLOCK (i), dom_bb; edge e; + int sum; + gcov_type lsum; fprintf (file, "\nBasic block %d: first insn %d, last %d, ", i, INSN_UID (bb->head), INSN_UID (bb->end)); @@ -529,6 +531,37 @@ dump_flow_info (file) dump_regset (bb->global_live_at_end, file); putc ('\n', file); + + /* Check the consistency of profile information. We can't do that + in verify_flow_info, as the counts may get invalid for incompletely + solved graphs, later elliminating of conditionals or roundoff errors. + It is still practical to have them reported for debugging of simple + testcases. */ + sum = 0; + for (e = bb->succ; e; e = e->succ_next) + sum += e->probability; + if (bb->succ && abs (sum - REG_BR_PROB_BASE) > 100) + fprintf (file, "Invalid sum of outgoing probabilities %.1f%%\n", + sum * 100.0 / REG_BR_PROB_BASE); + sum = 0; + for (e = bb->pred; e; e = e->pred_next) + sum += EDGE_FREQUENCY (e); + if (abs (sum - bb->frequency) > 100) + fprintf (file, + "Invalid sum of incomming frequencies %i, should be %i\n", + sum, bb->frequency); + lsum = 0; + for (e = bb->pred; e; e = e->pred_next) + lsum += e->count; + if (lsum - bb->count > 100 || lsum - bb->count < -100) + fprintf (file, "Invalid sum of incomming counts %i, should be %i\n", + (int)lsum, (int)bb->count); + lsum = 0; + for (e = bb->succ; e; e = e->succ_next) + lsum += e->count; + if (bb->succ && (lsum - bb->count > 100 || lsum - bb->count < -100)) + fprintf (file, "Invalid sum of incomming counts %i, should be %i\n", + (int)lsum, (int)bb->count); } putc ('\n', file); |