This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix combine EH related failure
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Richard Henderson <rth at redhat dot com>
- Date: Tue, 17 Feb 2004 11:38:56 +1030
- Subject: Re: Fix combine EH related failure
- References: <20040212010932.GD2631@bubble.modra.org>
On Thu, Feb 12, 2004 at 11:39:32AM +1030, Alan Modra wrote:
> Fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14119
As pointed out by rth on irc, my testing of PATTERN (i3) and
PATTERN (i2) against set0 and set1 was bogus, because these may have
been modified in place. I really don't like combine moving instructions
around for no purpose as shown in the PR, but that's a secondary problem
compared to dropping REG_EH_REGION notes. So.. This one just attacks
the REG_EH_REGION problem.
PR optimization/14119
* combine.c (try_combine): When attemting to fix unrecognized insns,
don't delete SETs marked with REG_EH_REGION notes.
Bootstrapping etc. in progress.
Index: gcc/combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.408
diff -u -p -w -r1.408 combine.c
--- gcc/combine.c 3 Feb 2004 05:15:35 -0000 1.408
+++ gcc/combine.c 17 Feb 2004 01:06:54 -0000
@@ -2017,7 +2017,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int
insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes);
/* If the result isn't valid, see if it is a PARALLEL of two SETs where
- the second SET's destination is a register that is unused. In that case,
+ the second SET's destination is a register that is unused and isn't
+ marked as an instruction that might trap in an EH region. In that case,
we just need the first SET. This can occur when simplifying a divmod
insn. We *must* test for this case here because the code below that
splits two independent SETs doesn't handle this case correctly when it
@@ -2033,11 +2034,14 @@ try_combine (rtx i3, rtx i2, rtx i1, int
{
rtx set0 = XVECEXP (newpat, 0, 0);
rtx set1 = XVECEXP (newpat, 0, 1);
+ rtx note;
if (((GET_CODE (SET_DEST (set1)) == REG
&& find_reg_note (i3, REG_UNUSED, SET_DEST (set1)))
|| (GET_CODE (SET_DEST (set1)) == SUBREG
&& find_reg_note (i3, REG_UNUSED, SUBREG_REG (SET_DEST (set1)))))
+ && (!(note = find_reg_note (i3, REG_EH_REGION, NULL_RTX))
+ || INTVAL (XEXP (note, 0)) <= 0)
&& ! side_effects_p (SET_SRC (set1)))
{
newpat = set0;
@@ -2049,6 +2053,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int
|| (GET_CODE (SET_DEST (set0)) == SUBREG
&& find_reg_note (i3, REG_UNUSED,
SUBREG_REG (SET_DEST (set0)))))
+ && (!(note = find_reg_note (i3, REG_EH_REGION, NULL_RTX))
+ || INTVAL (XEXP (note, 0)) <= 0)
&& ! side_effects_p (SET_SRC (set0)))
{
newpat = set1;
--
Alan Modra
IBM OzLabs - Linux Technology Centre