]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/31944 (Endless loop while building a 64-bit 2.6.20 kernel)
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 14 Jan 2008 12:19:58 +0000 (12:19 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 14 Jan 2008 12:19:58 +0000 (12:19 +0000)
PR rtl-optimization/31944
* cse.c (remove_pseudo_from_table): New function.
(merge_equiv_classes): Use above function to remove pseudo-registers.
(invalidate): Likewise.

From-SVN: r131524

gcc/ChangeLog
gcc/cse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20080114-1.c [new file with mode: 0644]

index 8ae029b6c10eddb9bc016be3cd52bc8e2acdeba0..42b678c3e092452efb39591a0215f6992965ac6e 100644 (file)
@@ -1,3 +1,10 @@
+2008-01-14  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR rtl-optimization/31944
+       * cse.c (remove_pseudo_from_table): New function.
+       (merge_equiv_classes): Use above function to remove pseudo-registers.
+       (invalidate): Likewise.
+
 2007-12-31  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR driver/33772
index 70fec9eec63860483a2c6288f10934adf1bf142e..a35c41c8a0d17b0314d75ac747225937adc6dae9 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -583,7 +583,8 @@ static void delete_reg_equiv (unsigned int);
 static int mention_regs (rtx);
 static int insert_regs (rtx, struct table_elt *, int);
 static void remove_from_table (struct table_elt *, unsigned);
-static struct table_elt *lookup        (rtx, unsigned, enum machine_mode);
+static void remove_pseudo_from_table (rtx, unsigned);
+static struct table_elt *lookup (rtx, unsigned, enum machine_mode);
 static struct table_elt *lookup_for_remove (rtx, unsigned, enum machine_mode);
 static rtx lookup_as_function (rtx, enum rtx_code);
 static struct table_elt *insert (rtx, struct table_elt *, unsigned,
@@ -1382,6 +1383,19 @@ remove_from_table (struct table_elt *elt, unsigned int hash)
   table_size--;
 }
 
+/* Same as above, but X is a pseudo-register.  */
+
+static void
+remove_pseudo_from_table (rtx x, unsigned int hash)
+{
+  struct table_elt *elt;
+
+  /* Because a pseudo-register can be referenced in more than one
+     mode, we might have to remove more than one table entry.  */
+  while ((elt = lookup_for_remove (x, hash, VOIDmode)))
+    remove_from_table (elt, hash);
+}
+
 /* Look up X in the hash table and return its table element,
    or 0 if X is not in the table.
 
@@ -1708,7 +1722,10 @@ merge_equiv_classes (struct table_elt *class1, struct table_elt *class2)
              delete_reg_equiv (REGNO (exp));
            }
 
-         remove_from_table (elt, hash);
+         if (REG_P (exp) && REGNO (exp) >= FIRST_PSEUDO_REGISTER)
+           remove_pseudo_from_table (exp, hash);
+         else
+           remove_from_table (elt, hash);
 
          if (insert_regs (exp, class1, 0) || need_rehash)
            {
@@ -1804,14 +1821,7 @@ invalidate (rtx x, enum machine_mode full_mode)
        SUBREG_TICKED (regno) = -1;
 
        if (regno >= FIRST_PSEUDO_REGISTER)
-         {
-           /* Because a register can be referenced in more than one mode,
-              we might have to remove more than one table entry.  */
-           struct table_elt *elt;
-
-           while ((elt = lookup_for_remove (x, hash, GET_MODE (x))))
-             remove_from_table (elt, hash);
-         }
+         remove_pseudo_from_table (x, hash);
        else
          {
            HOST_WIDE_INT in_table
index e041686832bbb0b6b0bce2bf28dadfc4ed16a4f1..99e21bf25bf0c44743e69e06ce6d4da761c41fa5 100644 (file)
@@ -1,3 +1,7 @@
+2008-01-14  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.c-torture/compile/20080114-1.c: New test.
+
 2008-01-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.c-torture/execute/builtins/chk.h: Don't check !__PIE__.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080114-1.c b/gcc/testsuite/gcc.c-torture/compile/20080114-1.c
new file mode 100644 (file)
index 0000000..51affb7
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR rtl-optimization/31944 */
+/* Origin: Aurelien Jarno <aurelien@aurel32.net> */
+
+int type;
+
+void stuck(int res)
+{
+  if (type == 1) {
+    if (res == 0) asm volatile("nop");
+  }
+  else if (type == 0) {
+    if (res == 0) asm volatile("nop" : : "i" (0));
+  }
+}