summaryrefslogtreecommitdiff
path: root/gcc/reorg.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-16 15:38:19 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-16 15:38:19 +0000
commitf9c6f14d623ddb87a40b7815a3b052d57a1f2c38 (patch)
treec319077994161c5a5df9b44f54d22e7cf5199a43 /gcc/reorg.c
parentfafa1b4027cf6f2b496b75e0a4c083f1c2fd1561 (diff)
downloadgcc-f9c6f14d623ddb87a40b7815a3b052d57a1f2c38.tar.gz
* reorg.c (mostly_true_jump): Clean up code depending on
LABEL_OUTSIDE_LOOP_P and loop notes. Remove code doing poor man's branch prediction, instead rely on REG_BR_PROB notes to be available. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108653 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reorg.c')
-rw-r--r--gcc/reorg.c56
1 files changed, 3 insertions, 53 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 46154f1fd3a..104ad8e467f 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -964,8 +964,7 @@ mostly_true_jump (rtx jump_insn, rtx condition)
{
rtx target_label = JUMP_LABEL (jump_insn);
rtx insn, note;
- int rare_dest = rare_destination (target_label);
- int rare_fallthrough = rare_destination (NEXT_INSN (jump_insn));
+ int rare_dest, rare_fallthrough;
/* If branch probabilities are available, then use that number since it
always gives a correct answer. */
@@ -984,32 +983,10 @@ mostly_true_jump (rtx jump_insn, rtx condition)
return -1;
}
- /* ??? Ought to use estimate_probability instead. */
-
- /* 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
- && ((GET_CODE (XEXP (SET_SRC (PATTERN (jump_insn)), 1)) == LABEL_REF
- && LABEL_OUTSIDE_LOOP_P (XEXP (SET_SRC (PATTERN (jump_insn)), 1)))
- || (GET_CODE (XEXP (SET_SRC (PATTERN (jump_insn)), 2)) == LABEL_REF
- && LABEL_OUTSIDE_LOOP_P (XEXP (SET_SRC (PATTERN (jump_insn)), 2)))))
- return -1;
-
- if (target_label)
- {
- /* If this is the test of a loop, it is very likely true. We scan
- backwards from the target label. If we find a NOTE_INSN_LOOP_BEG
- before the next real insn, we assume the branch is to the top of
- the loop. */
- for (insn = PREV_INSN (target_label);
- insn && NOTE_P (insn);
- insn = PREV_INSN (insn))
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- return 2;
- }
-
/* Look at the relative rarities of the fallthrough and destination. If
they differ, we can predict the branch that way. */
+ rare_dest = rare_destination (target_label);
+ rare_fallthrough = rare_destination (NEXT_INSN (jump_insn));
switch (rare_fallthrough - rare_dest)
{
@@ -1030,33 +1007,6 @@ mostly_true_jump (rtx jump_insn, rtx condition)
if (condition == 0)
return 0;
- /* EQ tests are usually false and NE tests are usually true. Also,
- most quantities are positive, so we can make the appropriate guesses
- about signed comparisons against zero. */
- switch (GET_CODE (condition))
- {
- case CONST_INT:
- /* Unconditional branch. */
- return 1;
- case EQ:
- return 0;
- case NE:
- return 1;
- case LE:
- case LT:
- if (XEXP (condition, 1) == const0_rtx)
- return 0;
- break;
- case GE:
- case GT:
- if (XEXP (condition, 1) == const0_rtx)
- return 1;
- break;
-
- default:
- break;
- }
-
/* Predict backward branches usually take, forward branches usually not. If
we don't know whether this is forward or backward, assume the branch
will be taken, since most are. */