loop.c (move_movables): Handle combination of m->consec...
authorUlrich Weigand <uweigand@de.ibm.com>
Thu, 18 Dec 2003 12:15:37 +0000 (12:15 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Thu, 18 Dec 2003 12:15:37 +0000 (12:15 +0000)
ChangeLog:
* loop.c (move_movables): Handle combination of m->consec,
m->move_insn_first, and m->insert_temp all nonzero correctly.
testsuite/ChangeLog:
* gcc.dg/20031216-1.c: New test.

From-SVN: r74778

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

index b0c3a3018c95567e1b0fdc689b80f238a54cf3e0..6d2db65e7d50163025d5f494b8b4713a566d534e 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-18  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * loop.c (move_movables): Handle combination of m->consec, 
+       m->move_insn_first, and m->insert_temp all nonzero correctly.
+
 2003-12-18  Kazu Hirata  <kazu@cs.umass.edu>
 
        * calls.c (load_register_parameters): Don't use
index 93bb328be349404c82b9f10155338b8da4ed5921..d53297550582d68b82ee0ac1d56a31c39c6d4975 100644 (file)
@@ -2113,7 +2113,8 @@ move_movables (struct loop *loop, struct loop_movables *movables,
                          /* The SET_SRC might not be invariant, so we must
                             use the REG_EQUAL note.  */
                          start_sequence ();
-                         emit_move_insn (m->set_dest, m->set_src);
+                         emit_move_insn (m->insert_temp ? newreg : m->set_dest,
+                                         m->set_src);
                          seq = get_insns ();
                          end_sequence ();
 
index d4524f3aabdf97f9d75cff94776597767c8a180a..33e5eb89ae621c53a7d5aba7c0f99ad0947d6992 100644 (file)
@@ -1,3 +1,7 @@
+2003-12-18  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * gcc.dg/20031216-1.c: New test.
+
 2003-12-18  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/9154
diff --git a/gcc/testsuite/gcc.dg/20031216-1.c b/gcc/testsuite/gcc.dg/20031216-1.c
new file mode 100644 (file)
index 0000000..d8ee070
--- /dev/null
@@ -0,0 +1,37 @@
+/* This used to abort due to a loop bug on s390*.  */
+
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -fPIC" { target s390*-*-* } } */
+
+int count = 0;
+char *str;
+
+void test (int flag)
+{
+  char *p;
+
+  for (;;)
+    {
+      if (count > 5)
+       return;
+
+      p = "test";
+
+      if (flag)
+       count++;
+
+      str = p;
+    }
+}
+
+int main (void)
+{
+  test (1);
+
+  if (str[0] != 't')
+    abort ();
+
+  return 0;
+}
+