summaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-05 17:34:16 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-05 17:34:16 +0000
commita2e423212fcde0a5659145ea2ac4de626297fc14 (patch)
tree4c6b7e31c08d36c2ce332bfd0f07dda9240944d1 /gcc/cfgrtl.c
parentc9fc348751f70ebf0e19713529ed9f6bd747da43 (diff)
downloadgcc-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/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c52
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;