diff options
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r-- | gcc/cfgrtl.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index a45d4a37f7e..151502087ac 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1651,7 +1651,36 @@ verify_flow_info () basic_block bb = BASIC_BLOCK (i); int has_fallthru = 0; edge e; + rtx note; + if (INSN_P (bb->end) + && (note = find_reg_note (bb->end, REG_BR_PROB, NULL_RTX))) + { + if (!any_condjump_p (bb->end)) + { + error ("verify_flow_info: REG_BR_PROB on non-condjump", + bb->index); + err = 1; + } + if (INTVAL (XEXP (note, 0)) != BRANCH_EDGE (bb)->probability) + { + error ("verify_flow_info: REG_BR_PROB does not match cfg %i %i", + INTVAL (XEXP (note, 0)), BRANCH_EDGE (bb)->probability); + err = 1; + } + } + if (bb->count < 0) + { + error ("verify_flow_info: Wrong count of block %i %i", + bb->index, (int)bb->count); + err = 1; + } + if (bb->frequency < 0) + { + error ("verify_flow_info: Wrong frequency of block %i %i", + bb->index, bb->frequency); + err = 1; + } for (e = bb->succ; e; e = e->succ_next) { if (last_visited [e->dest->index + 2] == bb) @@ -1660,6 +1689,18 @@ verify_flow_info () e->src->index, e->dest->index); err = 1; } + if (e->probability < 0 || e->probability > REG_BR_PROB_BASE) + { + error ("verify_flow_info: Wrong probability of edge %i->%i %i", + e->src->index, e->dest->index, e->probability); + err = 1; + } + if (e->count < 0) + { + error ("verify_flow_info: Wrong count of edge %i->%i %i", + e->src->index, e->dest->index, (int)e->count); + err = 1; + } last_visited [e->dest->index + 2] = bb; @@ -1935,6 +1976,17 @@ purge_dead_edges (bb) && !simplejump_p (insn)) return false; + /* Branch probability/prediction notes are defined only for + condjumps. We've possibly turned condjump into simplejump. */ + if (simplejump_p (insn)) + { + note = find_reg_note (insn, REG_BR_PROB, NULL); + if (note) + remove_note (insn, note); + while ((note = find_reg_note (insn, REG_BR_PRED, NULL))) + remove_note (insn, note); + } + for (e = bb->succ; e; e = next) { next = e->succ_next; |