]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
loop.c (move_movables): Remove REG_EQUAL notes for conditional invariants as well.
authorAndreas Krebbel <krebbel1@de.ibm.com>
Tue, 8 May 2007 13:00:35 +0000 (13:00 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Tue, 8 May 2007 13:00:35 +0000 (13:00 +0000)
2007-05-08  Andreas Krebbel  <krebbel1@de.ibm.com>

* loop.c (move_movables): Remove REG_EQUAL notes for conditional
invariants as well.

2007-05-08  Andreas Krebbel  <krebbel1@de.ibm.com>

* gcc.dg/20070507-1.c: New testcase.

From-SVN: r124547

gcc/ChangeLog
gcc/loop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20070507-1.c [new file with mode: 0644]

index 522cbac6006e0beda72d90e3ba48d886a9bc1168..0c07567e43f988d44955de9ad78d3d06ca22f72e 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-08  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * loop.c (move_movables): Remove REG_EQUAL notes for conditional
+       invariants as well.
+
 2007-04-29  Bernd Schmidt  <bernd.schmidt@analog.com>
 
        * reload.c (combine_reloads): When trying to use a dying register,
index 8974972bd9f1c62c5970f62de406a1eb8d257712..43c3d92d2e46f31fd761b74ce190c46b238b9d80 100644 (file)
@@ -2561,7 +2561,7 @@ move_movables (struct loop *loop, struct loop_movables *movables,
                             like this as a result of record_jump_cond.  */
 
                          if ((temp = find_reg_note (i1, REG_EQUAL, NULL_RTX))
-                             && ! loop_invariant_p (loop, XEXP (temp, 0)))
+                             && loop_invariant_p (loop, XEXP (temp, 0)) != 1)
                            remove_note (i1, temp);
                        }
 
index b330ef6ae5ea0203d5291b857a4f73db7403f9aa..54769f373721e790fb489fc3bfe54735cb6a67d6 100644 (file)
@@ -1,3 +1,7 @@
+2007-05-08  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * gcc.dg/20070507-1.c: New testcase.
+
 2007-04-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR C++/30221
diff --git a/gcc/testsuite/gcc.dg/20070507-1.c b/gcc/testsuite/gcc.dg/20070507-1.c
new file mode 100644 (file)
index 0000000..5d29d07
--- /dev/null
@@ -0,0 +1,103 @@
+/* This failed on s390x due to bug in loop.c.
+   loop.c failed to remove a REG_EQUAL note when
+   hoisting an insn from a loop body.  */
+
+/* { dg-options "-O3 -fPIC" } */
+/* { dg-do run } */
+
+typedef __SIZE_TYPE__ size_t;
+int memcmp(const void *s1, const void *s2, size_t n);
+
+typedef struct
+{
+  char name[30];
+  int a;
+} LOCAL;
+
+int global = 0;
+int sy = 1;
+int subroutine_offset;
+
+LOCAL local = { "local", 0 };
+LOCAL keywords = { "keywords", 1 };
+int local_table = 0;
+int keywords_table = 0;
+
+void __attribute__((noinline)) bar (char *p_buffer)
+{
+  p_buffer[255] = 1;
+}
+
+int __attribute__((noinline)) foo (char *p_str1)
+{
+  global = 1;
+  return 1;
+}
+
+int __attribute__((noinline)) loop_next (int *p_table, char *p_table_head)
+{
+  static loop_next = 0;
+
+  if (loop_next == 1)
+    return 1;
+
+  loop_next = 1;
+  return 0;
+}
+
+int
+main ()
+{
+  char buffer[256];
+  int ende = 0;
+  int index;
+  int local_base = 2;
+
+  keywords.a = 1;
+  for (sy = 0;; sy++)
+    {
+      for (index = 1;;)
+       {
+         bar (buffer);
+         if (buffer[sy] != 0)
+           {
+             ende = 1;
+             break;
+           };
+         if (foo (buffer))
+           {
+             keywords.a += index - 1;
+             break;
+           }
+         index++;
+       }
+      if (ende)
+       break;
+    }
+
+  subroutine_offset = 0;
+
+  for (;;)
+    {
+      if (loop_next (&keywords_table, (char*)&keywords))
+       break;
+
+      if ((!memcmp (keywords.name, "+++", 3)))
+       local_base = 100;
+      else
+       local_base = 0;
+
+      if ((!memcmp (keywords.name, "+++", 3)))
+       subroutine_offset += local_table;
+
+      for (;;)
+       {
+         if (loop_next (&local_table, (char*)&local))
+           break;;
+         if ((local.a == 0))
+           continue;;
+         foo (local.name);
+       }
+    }
+  return 0;
+}