From 539c54bafbbc73ce79ee1681598b6451e748aad4 Mon Sep 17 00:00:00 2001 From: Kaz Kojima Date: Mon, 21 Jan 2008 00:04:23 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 ++++ gcc/emit-rtl.c | 14 ++++++++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.c-torture/compile/pr34808.c | 29 +++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr34808.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a327d48025c..cc25fb742414 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-01-20 Kaz Kojima + + PR rtl-optimization/34808 + * emit-rtl.c (try_split): Handle REG_RETVAL notes. + 2008-01-20 Richard Sandiford * 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 bef4d58f53d0..1a9239ab8a59 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 61be06444483..d0e06564daae 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-20 Kaz Kojima + + PR rtl-optimization/34808 + * gcc.c-torture/compile/pr34808.c: New test. + 2008-01-20 Paul Thomas 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 000000000000..8224061e693d --- /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; +} -- 2.47.2