jump.c (squeeze_notes): Return true if no real insns were found.
authorJakub Jelinek <jakub@redhat.com>
Thu, 15 Nov 2001 10:28:52 +0000 (11:28 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 15 Nov 2001 10:28:52 +0000 (11:28 +0100)
* 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.

* gcc.c-torture/compile/20011114-4.c: New test.

From-SVN: r47048

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/ifcvt.c
gcc/jump.c
gcc/loop.c
gcc/rtl.h
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20011114-4.c [new file with mode: 0644]

index e8a3715e1545ef5e5a11fe8a56e56f4d0126e3d5..7fb7529d9672dd36644b48e45b6ef059cf1e45ab 100644 (file)
@@ -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.
index cb781d7fe4252fb3e8c28334771ebef1efd9ca50..03f767a4df396b1df8c20eb1bd0e0014d830b470 100644 (file)
@@ -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);
index e056cad6dc672a8b235867fb7d35732f914deaa6..5dd42fc8d7efa9c0dd5b1a5538118b808909feab 100644 (file)
@@ -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));
     }
index a7f18c058d4324873872375284c66f10441964f2..c886aca6047de2c81a7c2f0823e90b3829cba2f7 100644 (file)
@@ -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;
 }
 \f
 /* Return the label before INSN, or put a new label there.  */
index adc4a0b7b0ed8c07fb4486dbbd6a6661caa114a4..6acdb9cb050eb49979d696274fea731f3bffe30f 100644 (file)
@@ -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.  */
index 872d70dbf776f16718967569a88bf4a4ff0d5db6..01e0fb6ec72568e7856b363101dbd615b0ff6c8e 100644 (file)
--- 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));
index 53e1477842274b53166c18f2fc1169e0fbf7bf82..3f940e379a782836e9524ffd4a1af578d5b795f7 100644 (file)
@@ -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);
     }
index e544dcc57e8b34e31047247332af76971f89f16f..9c2c4c8e29fc1aff26eb481e8956142233affc04 100644 (file)
@@ -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 (file)
index 0000000..516ef4f
--- /dev/null
@@ -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);
+}