diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1992-12-27 10:46:56 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1992-12-27 10:46:56 -0500 |
commit | 4d0e69c3f028843b21182d4d4431b5a93766673b (patch) | |
tree | 8e8de4b74ccee3ffacb1b1787bdc49ca9e026032 | |
parent | cf526dcc5c28c03eb46440208663802b4f4bc171 (diff) | |
download | gcc-4d0e69c3f028843b21182d4d4431b5a93766673b.zip gcc-4d0e69c3f028843b21182d4d4431b5a93766673b.tar.gz gcc-4d0e69c3f028843b21182d4d4431b5a93766673b.tar.bz2 |
(mostly_true_jump): When trying to determine if the current insn is essentially a conditional return...
(mostly_true_jump): When trying to determine if the current insn is
essentially a conditional return, look inside of SEQUENCE insns for
jumps.
Predict jumps to the exit test for loops as likely to be taken.
From-SVN: r2925
-rw-r--r-- | gcc/reorg.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c index bf8104e..bcee35e 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -1069,10 +1069,13 @@ mostly_true_jump (jump_insn, condition) /* If TARGET_LABEL has no jumps between it and the end of the function, this is essentially a conditional return, so predict it as false. */ - for (insn = NEXT_INSN (target_label); - insn && GET_CODE (insn) != JUMP_INSN; - insn = NEXT_INSN (insn)) - ; + for (insn = NEXT_INSN (target_label); insn; insn = NEXT_INSN (insn)) + { + if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE) + insn = XVECEXP (PATTERN (insn), 0, 0); + if (GET_CODE (insn) == JUMP_INSN) + break; + } if (insn == 0) return 0; @@ -1086,6 +1089,16 @@ mostly_true_jump (jump_insn, condition) if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG) return 2; + /* If this is a jump to the test of a loop, it is likely true. We scan + forwards from the target label. If we find a NOTE_INSN_LOOP_VTOP + before the next real insn, we assume the branch is to the loop branch + test. */ + for (insn = NEXT_INSN (target_label); + insn && GET_CODE (insn) == NOTE; + insn = PREV_INSN (insn)) + if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_VTOP) + return 1; + /* If we couldn't figure out what this jump was, assume it won't be taken. This should be rare. */ if (condition == 0) |