aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@cygnus.co.uk>2000-01-28 18:00:04 +0000
committerBernd Schmidt <crux@gcc.gnu.org>2000-01-28 18:00:04 +0000
commit52bea68432b328568fecb275db3744ef746b3788 (patch)
treee04349b8743f6e57eb670c2cf762bb930a1b9a53
parentb9ff48144498c9cc2b5f3fd6bd03391579bd24cd (diff)
downloadgcc-52bea68432b328568fecb275db3744ef746b3788.zip
gcc-52bea68432b328568fecb275db3744ef746b3788.tar.gz
gcc-52bea68432b328568fecb275db3744ef746b3788.tar.bz2
Delete a superfluous and buggy optimization
From-SVN: r31670
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/jump.c119
2 files changed, 5 insertions, 119 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0ed0123..a482aaf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2000-01-28 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * jump.c (jump_optimize_1): Delete an optimization that is also done
+ by merge_blocks in flow.
+
2000-01-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* diagnostic.c (build_message_string, output_printf,
diff --git a/gcc/jump.c b/gcc/jump.c
index 26cc011..0119d52 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1995,125 +1995,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, mark_labels_only)
#endif
else
{
- /* Look for if (foo) bar; else break; */
- /* The insns look like this:
- insn = condjump label1;
- ...range1 (some insns)...
- jump label2;
- label1:
- ...range2 (some insns)...
- jump somewhere unconditionally
- label2: */
- {
- rtx label1 = next_label (insn);
- rtx range1end = label1 ? prev_active_insn (label1) : 0;
- /* Don't do this optimization on the first round, so that
- jump-around-a-jump gets simplified before we ask here
- whether a jump is unconditional.
-
- Also don't do it when we are called after reload since
- it will confuse reorg. */
- if (! first
- && (reload_completed ? ! flag_delayed_branch : 1)
- /* Make sure INSN is something we can invert. */
- && condjump_p (insn)
- && label1 != 0
- && JUMP_LABEL (insn) == label1
- && LABEL_NUSES (label1) == 1
- && GET_CODE (range1end) == JUMP_INSN
- && simplejump_p (range1end))
- {
- rtx label2 = next_label (label1);
- rtx range2end = label2 ? prev_active_insn (label2) : 0;
- if (range1end != range2end
- && JUMP_LABEL (range1end) == label2
- && GET_CODE (range2end) == JUMP_INSN
- && GET_CODE (NEXT_INSN (range2end)) == BARRIER
- /* Invert the jump condition, so we
- still execute the same insns in each case. */
- && invert_jump (insn, label1))
- {
- rtx range1beg = next_active_insn (insn);
- rtx range2beg = next_active_insn (label1);
- rtx range1after, range2after;
- rtx range1before, range2before;
- rtx rangenext;
-
- /* Include in each range any notes before it, to be
- sure that we get the line number note if any, even
- if there are other notes here. */
- while (PREV_INSN (range1beg)
- && GET_CODE (PREV_INSN (range1beg)) == NOTE)
- range1beg = PREV_INSN (range1beg);
-
- while (PREV_INSN (range2beg)
- && GET_CODE (PREV_INSN (range2beg)) == NOTE)
- range2beg = PREV_INSN (range2beg);
-
- /* Don't move NOTEs for blocks or loops; shift them
- outside the ranges, where they'll stay put. */
- range1beg = squeeze_notes (range1beg, range1end);
- range2beg = squeeze_notes (range2beg, range2end);
-
- /* Get current surrounds of the 2 ranges. */
- range1before = PREV_INSN (range1beg);
- range2before = PREV_INSN (range2beg);
- range1after = NEXT_INSN (range1end);
- range2after = NEXT_INSN (range2end);
-
- /* Splice range2 where range1 was. */
- NEXT_INSN (range1before) = range2beg;
- PREV_INSN (range2beg) = range1before;
- NEXT_INSN (range2end) = range1after;
- PREV_INSN (range1after) = range2end;
- /* Splice range1 where range2 was. */
- NEXT_INSN (range2before) = range1beg;
- PREV_INSN (range1beg) = range2before;
- NEXT_INSN (range1end) = range2after;
- PREV_INSN (range2after) = range1end;
-
- /* Check for loop notes between the end of
- range2, and the next code label. If there is one,
- then what we have really seen is
- if (foo) break; end_of_loop;
- and moved the break sequence outside the loop.
- We must move LOOP_END, LOOP_VTOP and LOOP_CONT
- notes (in order) to where the loop really ends now,
- or we will confuse loop optimization. Stop if we
- find a LOOP_BEG note first, since we don't want to
- move the notes in that case. */
- for (;range2after != label2; range2after = rangenext)
- {
- rangenext = NEXT_INSN (range2after);
- if (GET_CODE (range2after) == NOTE)
- {
- int kind = NOTE_LINE_NUMBER (range2after);
- if (kind == NOTE_INSN_LOOP_END
- || kind == NOTE_INSN_LOOP_VTOP
- || kind == NOTE_INSN_LOOP_CONT)
- {
- NEXT_INSN (PREV_INSN (range2after))
- = rangenext;
- PREV_INSN (rangenext)
- = PREV_INSN (range2after);
- PREV_INSN (range2after)
- = PREV_INSN (range1beg);
- NEXT_INSN (range2after) = range1beg;
- NEXT_INSN (PREV_INSN (range1beg))
- = range2after;
- PREV_INSN (range1beg) = range2after;
- }
- else if (NOTE_LINE_NUMBER (range2after)
- == NOTE_INSN_LOOP_BEG)
- break;
- }
- }
- changed = 1;
- continue;
- }
- }
- }
-
/* Now that the jump has been tensioned,
try cross jumping: check for identical code
before the jump and before its target label. */