PR rtl-optimization/34808
authorkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Jan 2008 00:04:23 +0000 (00:04 +0000)
committerkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Jan 2008 00:04:23 +0000 (00:04 +0000)
* emit-rtl.c (try_split): Handle REG_RETVAL notes.
* gcc.c-torture/compile/pr34808.c: New test.

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

gcc/ChangeLog
gcc/emit-rtl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr34808.c [new file with mode: 0644]

index 4a327d4..cc25fb7 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-20  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR rtl-optimization/34808
+       * emit-rtl.c (try_split): Handle REG_RETVAL notes.
+
 2008-01-20  Richard Sandiford  <rsandifo@nildram.co.uk>
 
        * global.c (find_reg): Only compute EH_RETURN_DATA_REGNO once per
index bef4d58..1a9239a 100644 (file)
@@ -3136,7 +3136,7 @@ try_split (rtx pat, rtx trial, int last)
   rtx before = PREV_INSN (trial);
   rtx after = NEXT_INSN (trial);
   int has_barrier = 0;
-  rtx tem, note_retval;
+  rtx tem, note_retval, note_libcall;
   rtx note, seq;
   int probability;
   rtx insn_last, insn;
@@ -3284,6 +3284,18 @@ try_split (rtx pat, rtx trial, int last)
          XEXP (note_retval, 0) = insn_last;
          break;
 
+       case REG_RETVAL:
+         /* Relink the insns with REG_LIBCALL note and with REG_RETVAL note
+            after split.  */
+         REG_NOTES (insn_last) 
+           = gen_rtx_INSN_LIST (REG_RETVAL,
+                                XEXP (note, 0),
+                                REG_NOTES (insn_last)); 
+
+         note_libcall = find_reg_note (XEXP (note, 0), REG_LIBCALL, NULL);
+         XEXP (note_libcall, 0) = insn_last;
+         break;
+
        default:
          break;
        }
index 61be064..d0e0656 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-20  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR rtl-optimization/34808
+       * gcc.c-torture/compile/pr34808.c: New test.
+
 2008-01-20  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/34784
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34808.c b/gcc/testsuite/gcc.c-torture/compile/pr34808.c
new file mode 100644 (file)
index 0000000..8224061
--- /dev/null
@@ -0,0 +1,29 @@
+/* PR 34808 */
+/* { dg-do compile }
+/* { dg-options "-fno-tree-dominator-opts" } */
+
+extern int flags;
+
+struct r { int code; int val;};
+
+int
+foo (struct r *home)
+{
+  int n = 0;
+  int regno = -1;
+
+  if (home->code == 0)
+    regno = home->val;
+
+  if (home->code == 1)
+      bar ();
+  else if (regno >= 0)
+    n = (regno == 16
+        ? 16
+        : (regno - (unsigned long long) (flags != 0 ? 63 : 15)
+           ? regno - 128
+           : -1));
+
+  baz ();
+  return n;
+}