PR target/PR60169
authorJoey Ye <joey.ye@arm.com>
Fri, 28 Feb 2014 12:02:13 +0000 (12:02 +0000)
committerJoey Ye <jye2@gcc.gnu.org>
Fri, 28 Feb 2014 12:02:13 +0000 (12:02 +0000)
2014-02-28  Joey Ye  <joey.ye@arm.com>

        PR target/PR60169
* config/arm/arm.c (thumb_far_jump_used_p): Don't change
if reload in progress or completed.

testsuite:
* gcc.target/arm/thumb1-far-jump-3.c: New case.

From-SVN: r208217

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/thumb1-far-jump-3.c [new file with mode: 0644]

index 995957c447638c5c567c78f255cd5e836f38403a..c0304cf7539ac6c74fdccbcbce201855fe014e82 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-28  Joey Ye  <joey.ye@arm.com>
+
+       PR target/PR60169
+       * config/arm/arm.c (thumb_far_jump_used_p): Don't change
+       if reload in progress or completed.
+
 2014-02-28  Tobias Burnus  <burnus@net-b.de>
 
        PR middle-end/60147
index b49f43e3ea1047a346e12c95ededfc315c191658..ce24bfed732e9e00389e9d79c3e71e82a6c348c2 100644 (file)
@@ -26255,6 +26255,11 @@ thumb_far_jump_used_p (void)
        return 0;
     }
 
+  /* We should not change far_jump_used during or after reload, as there is
+     no chance to change stack frame layout.  */
+  if (reload_in_progress || reload_completed)
+    return 0;
+
   /* Check to see if the function contains a branch
      insn with the far jump attribute set.  */
   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
index 0259ba4fa0fca089862e367570f5e4b623de4845..dac918c89ae6bcfa1658ddee5a696985a244687a 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-28  Joey Ye  <joey.ye@arm.com>
+
+       PR target/PR60169
+       * gcc.target/arm/thumb1-far-jump-3.c: New case.
+
 2014-02-27  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/60253
diff --git a/gcc/testsuite/gcc.target/arm/thumb1-far-jump-3.c b/gcc/testsuite/gcc.target/arm/thumb1-far-jump-3.c
new file mode 100644 (file)
index 0000000..90559ba
--- /dev/null
@@ -0,0 +1,108 @@
+/* Catch reload ICE on target thumb1 with far jump optimization.
+ * It is also a valid case for non-thumb1 target.  */
+
+/* Add -mno-lra option as it is only reproducable with reload.  It will
+   be removed after reload is completely removed.  */
+/* { dg-options "-mno-lra -fomit-frame-pointer" } */
+/* { dg-do compile } */
+
+#define C      2
+#define A      4
+#define RGB  (C | A)
+#define GRAY (A)
+
+typedef unsigned long uint_32;
+typedef unsigned char byte;
+typedef byte        * bytep;
+
+typedef struct ss
+{
+   uint_32 w;
+   uint_32 r;
+   byte c;
+   byte b;
+   byte p;
+} info;
+
+typedef info * infop;
+
+void
+foo(infop info, bytep row)
+{
+   uint_32 iw = info->w;
+   if (info->c == RGB)
+   {
+      if (info->b == 8)
+      {
+         bytep sp = row + info->r;
+         bytep dp = sp;
+         byte save;
+         uint_32 i;
+
+         for (i = 0; i < iw; i++)
+         {
+            save = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = save;
+         }
+      }
+
+      else
+      {
+         bytep sp = row + info->r;
+         bytep dp = sp;
+         byte save[2];
+         uint_32 i;
+
+         for (i = 0; i < iw; i++)
+         {
+            save[0] = *(--sp);
+            save[1] = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = save[0];
+            *(--dp) = save[1];
+         }
+      }
+   }
+   else if (info->c == GRAY)
+   {
+      if (info->b == 8)
+      {
+         bytep sp = row + info->r;
+         bytep dp = sp;
+         byte save;
+         uint_32 i;
+
+         for (i = 0; i < iw; i++)
+         {
+            save = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = save;
+         }
+      }
+      else
+      {
+         bytep sp = row + info->r;
+         bytep dp = sp;
+         byte save[2];
+         uint_32 i;
+
+         for (i = 0; i < iw; i++)
+         {
+            save[0] = *(--sp);
+            save[1] = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = *(--sp);
+            *(--dp) = save[0];
+            *(--dp) = save[1];
+         }
+      }
+   }
+}