aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2008-01-21 00:04:23 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2008-01-21 00:04:23 +0000
commit539c54bafbbc73ce79ee1681598b6451e748aad4 (patch)
tree64303f27f89458803f70c53d0d7bf928ee7252a5 /gcc
parentf5d67ede42caa6e1442a4776a4929a8a96907caf (diff)
downloadgcc-539c54bafbbc73ce79ee1681598b6451e748aad4.zip
gcc-539c54bafbbc73ce79ee1681598b6451e748aad4.tar.gz
gcc-539c54bafbbc73ce79ee1681598b6451e748aad4.tar.bz2
re PR rtl-optimization/34808 (ICE in prescan_insns_for_dce)
PR rtl-optimization/34808 * emit-rtl.c (try_split): Handle REG_RETVAL notes. * gcc.c-torture/compile/pr34808.c: New test. From-SVN: r131680
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/emit-rtl.c14
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr34808.c29
4 files changed, 52 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a327d4..cc25fb7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index bef4d58..1a9239a 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 61be064..d0e0656 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..8224061
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr34808.c
@@ -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;
+}