summaryrefslogtreecommitdiff
path: root/gcc/reorg.c
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>1997-03-28 22:38:24 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>1997-03-28 22:38:24 +0000
commit0a29623e46c985fd4d9e42d26f0d32feb5efdd74 (patch)
tree999c5704b3c88aeabc57a507f7efc9001f0fad46 /gcc/reorg.c
parent6e5fdcc08a0ece1ac98b7c4c75ae064d7286c539 (diff)
downloadgcc-0a29623e46c985fd4d9e42d26f0d32feb5efdd74.tar.gz
* reorg.c (mostly_true_jump): Use REG_BR_PROB notes when
flag_branch_probabilities. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13819 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reorg.c')
-rw-r--r--gcc/reorg.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 8f08afb054b..8cd44731a5e 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1350,6 +1350,26 @@ mostly_true_jump (jump_insn, condition)
int rare_dest = rare_destination (target_label);
int rare_fallthrough = rare_destination (NEXT_INSN (jump_insn));
+ /* If branch probabilities are available, then use that number since it
+ always gives a correct answer. */
+ if (flag_branch_probabilities)
+ {
+ rtx note = find_reg_note (jump_insn, REG_BR_PROB, 0);;
+ if (note)
+ {
+ int prob = XINT (note, 0);
+
+ if (prob >= REG_BR_PROB_BASE * 9 / 10)
+ return 2;
+ else if (prob >= REG_BR_PROB_BASE / 2)
+ return 1;
+ else if (prob >= REG_BR_PROB_BASE / 10)
+ return 0;
+ else
+ return -1;
+ }
+ }
+
/* If this is a branch outside a loop, it is highly unlikely. */
if (GET_CODE (PATTERN (jump_insn)) == SET
&& GET_CODE (SET_SRC (PATTERN (jump_insn))) == IF_THEN_ELSE