OSDN Git Service

gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 11 Feb 2012 09:00:42 +0000 (09:00 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 11 Feb 2012 09:00:42 +0000 (09:00 +0000)
PR rtl-optimization/52175
* reorg.c (fill_slots_from_thread): Don't apply add/sub optimization
to frame-related instructions.

gcc/testsuite/
PR rtl-optimization/52175
* gcc.c-torture/compile/pr52175.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184128 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/reorg.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr52175.c [new file with mode: 0644]

index 9dce424..b9af710 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR rtl-optimization/52175
+       * reorg.c (fill_slots_from_thread): Don't apply add/sub optimization
+       to frame-related instructions.
+
 2012-02-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/51910
 2012-02-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/51910
index 3fa5393..dfc9747 100644 (file)
@@ -2937,6 +2937,7 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
   if (delay_list == 0 && likely
       && new_thread && !ANY_RETURN_P (new_thread)
       && NONJUMP_INSN_P (new_thread)
   if (delay_list == 0 && likely
       && new_thread && !ANY_RETURN_P (new_thread)
       && NONJUMP_INSN_P (new_thread)
+      && !RTX_FRAME_RELATED_P (new_thread)
       && GET_CODE (PATTERN (new_thread)) != ASM_INPUT
       && asm_noperands (PATTERN (new_thread)) < 0)
     {
       && GET_CODE (PATTERN (new_thread)) != ASM_INPUT
       && asm_noperands (PATTERN (new_thread)) < 0)
     {
index 812cee1..03fba54 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR rtl-optimization/52175
+       * gcc.c-torture/compile/pr52175.c: New test.
+
 2012-02-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/51910
 2012-02-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/51910
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52175.c b/gcc/testsuite/gcc.c-torture/compile/pr52175.c
new file mode 100644 (file)
index 0000000..e0aed77
--- /dev/null
@@ -0,0 +1,25 @@
+void bad (void);
+char *foo (char *src, char **last)
+{
+  char *dst;
+  int ch;
+  dst = src = (src ? src : *last);
+
+  if (*src == 0)
+    return 0;
+
+  while (src[0])
+    {
+      if (!src[1])
+       {
+         bad ();
+         break;
+       }
+      *dst = *src;
+      dst += 1;
+      src += 2;
+    }
+  *last = src;
+  *dst = 0;
+  return *last;
+}