summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/cfgcleanup.c6
-rw-r--r--gcc/ifcvt.c3
-rw-r--r--gcc/jump.c11
-rw-r--r--gcc/loop.c3
-rw-r--r--gcc/rtl.h2
-rw-r--r--gcc/stmt.c3
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20011114-4.c38
9 files changed, 71 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8a3715e154..7fb7529d967 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2001-11-15 Jakub Jelinek <jakub@redhat.com>
+
+ * jump.c (squeeze_notes): Return true if no real insns were found.
+ * rtl.h (squeeze_notes): Adjust prototype.
+ * cfgcleanup.c (merge_blocks_move_predecessor_nojumps): If
+ squeeze_notes finds no real instructions, abort.
+ (merge_blocks_move_successor_nojumps): Likewise.
+ * loop.c (find_and_verify_loops): Likewise.
+ * stmt.c (expand_end_case): Likewise.
+ * ifcvt.c (dead_or_predicable): Return TRUE if squeeze_notes doesn't
+ find any real instructions.
+
2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
* c-common.c: Include c-lex.h.
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index cb781d7fe42..03f767a4df3 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -329,7 +329,8 @@ merge_blocks_move_predecessor_nojumps (a, b)
and adjust the block trees appropriately. Even better would be to have
a tighter connection between block trees and rtl so that this is not
necessary. */
- squeeze_notes (&a->head, &a->end);
+ if (squeeze_notes (&a->head, &a->end))
+ abort ();
/* Scramble the insn chain. */
if (a->end != PREV_INSN (b->head))
@@ -393,7 +394,8 @@ merge_blocks_move_successor_nojumps (a, b)
and adjust the block trees appropriately. Even better would be to have
a tighter connection between block trees and rtl so that this is not
necessary. */
- squeeze_notes (&b->head, &b->end);
+ if (squeeze_notes (&b->head, &b->end))
+ abort ();
/* Scramble the insn chain. */
reorder_insns_nobb (b->head, b->end, a->end);
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index e056cad6dc6..5dd42fc8d7e 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2659,7 +2659,8 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
if (end == merge_bb->end)
merge_bb->end = PREV_INSN (head);
- squeeze_notes (&head, &end);
+ if (squeeze_notes (&head, &end))
+ return TRUE;
reorder_insns (head, end, PREV_INSN (earliest));
}
diff --git a/gcc/jump.c b/gcc/jump.c
index a7f18c058d4..c886aca6047 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -541,9 +541,10 @@ duplicate_loop_exit_test (loop_start)
/* Move all block-beg, block-end, loop-beg, loop-cont, loop-vtop, loop-end,
notes between START and END out before START. START and END may be such
notes. Returns the values of the new starting and ending insns, which
- may be different if the original ones were such notes. */
+ may be different if the original ones were such notes.
+ Return true if there were only such notes and no real instructions. */
-void
+bool
squeeze_notes (startp, endp)
rtx* startp;
rtx* endp;
@@ -584,15 +585,15 @@ squeeze_notes (startp, endp)
last = insn;
}
- /* There were no real instructions, and we can't represent an empty
- range. Die. */
+ /* There were no real instructions. */
if (start == past_end)
- abort ();
+ return true;
end = last;
*startp = start;
*endp = end;
+ return false;
}
/* Return the label before INSN, or put a new label there. */
diff --git a/gcc/loop.c b/gcc/loop.c
index adc4a0b7b0e..6acdb9cb050 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -2748,7 +2748,8 @@ find_and_verify_loops (f, loops)
/* Include the BARRIER after INSN and copy the
block after LOC. */
- squeeze_notes (&new_label, &last_insn_to_move);
+ if (squeeze_notes (&new_label, &last_insn_to_move))
+ abort ();
reorder_insns (new_label, last_insn_to_move, loc);
/* All those insns are now in TARGET_LOOP. */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 872d70dbf77..01e0fb6ec72 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1340,7 +1340,7 @@ extern void mark_jump_label PARAMS ((rtx, rtx, int));
extern void cleanup_barriers PARAMS ((void));
/* In jump.c */
-extern void squeeze_notes PARAMS ((rtx *, rtx *));
+extern bool squeeze_notes PARAMS ((rtx *, rtx *));
extern rtx delete_related_insns PARAMS ((rtx));
extern void delete_jump PARAMS ((rtx));
extern void delete_barrier PARAMS ((rtx));
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 53e14778422..3f940e379a7 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -5598,7 +5598,8 @@ expand_end_case (orig_index)
before_case = NEXT_INSN (before_case);
end = get_last_insn ();
- squeeze_notes (&before_case, &end);
+ if (squeeze_notes (&before_case, &end))
+ abort ();
reorder_insns (before_case, end,
thiscase->data.case_stmt.start);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e544dcc57e8..9c2c4c8e29f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-11-15 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/compile/20011114-4.c: New test.
+
2001-11-15 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/other/init1.C: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011114-4.c b/gcc/testsuite/gcc.c-torture/compile/20011114-4.c
new file mode 100644
index 00000000000..516ef4f2325
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20011114-4.c
@@ -0,0 +1,38 @@
+static inline int foo (long x)
+{
+ register int a = 0;
+ register unsigned b;
+
+ do
+ {
+ b = (x & 0x7f);
+ x = (x >> 7) | ~(-1L >> 7);
+ a += 1;
+ }
+ while ((x != 0 || (b & 0x40) != 0) && (x != -1 || (b & 0x40) == 0));
+ return a;
+}
+
+static inline int bar (unsigned long x)
+{
+ register int a = 0;
+ register unsigned b;
+
+ do
+ {
+ b = (x & 0x7f);
+ x >>= 7;
+ a++;
+ }
+ while (x != 0);
+ return a;
+}
+
+int
+baz (unsigned long x, int y)
+{
+ if (y)
+ return foo ((long) x);
+ else
+ return bar (x);
+}