This is the mail archive of the
mailing list for the GCC project.
PR27736: Fix bootstrap fallout from PR25514
- From: Richard Sandiford <richard at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 May 2006 14:05:19 +0100
- Subject: PR27736: Fix bootstrap fallout from PR25514
- References: <firstname.lastname@example.org> <Pine.LNX.email@example.com>
In my fix for PR 25514, I'd forgotten to handle the case where the
REG_EQUAL value is not constant, and itself refers to registers.
combine already checks whether the registers and memories mentioned in
the REG_EQUAL note are a subset of those mentioned in the insn itself;
the new code I added should only be used if the REG_DEAD register is
not in that subset.
I think the best way of doing that is to cache a copy of the new SET_SRC
as well as a pointer to the containing insn. It's unfortuante that we
have to create garbage rtl like this, but in the common case of a
constant REG_EQUAL note, the copy will be a no-op.
Bootstrapped & regression tested on x86_64-linux-gnu, where it fixes
the gcc.c-torture/execute/20040709-2.c execution failures introduced
by my original patch. Also tested on mips64-linux-gnu. I verified
that this fixed the hppa-linux-gnu ICE mentioned in PR27736 itself.
OK to install?
* combine.c (replaced_rhs_value): New variable.
(combine_instructions): Set it.
(distribute_notes): When distributing a note in replaced_rhs_insn,
check whether the value was used in replaced_rhs_value.
--- gcc/combine.c (revision 113983)
+++ gcc/combine.c (working copy)
@@ -128,6 +128,11 @@ Software Foundation; either version 2, o
so modified, or null if none. */
static rtx replaced_rhs_insn;
+/* When REPLACED_RHS_INSN is nonnull, this is a copy of the new right
+ hand side. */
+static rtx replaced_rhs_value;
/* Vector mapping INSN_UIDs to cuids.
The cuids are like uids but increase monotonically always.
@@ -928,6 +933,7 @@ combine_instructions (rtx f, unsigned in
rtx orig = SET_SRC (set);
SET_SRC (set) = note;
replaced_rhs_insn = temp;
+ replaced_rhs_value = copy_rtx (note);
next = try_combine (insn, temp, NULL_RTX,
replaced_rhs_insn = NULL;
@@ -12122,7 +12128,9 @@ distribute_notes (rtx notes, rtx from_in
In both cases, we must search to see if we can find a previous
use of A and put the death note there. */
- if (from_insn && from_insn == replaced_rhs_insn)
+ if (from_insn
+ && from_insn == replaced_rhs_insn
+ && !reg_overlap_mentioned_p (XEXP (note, 0), replaced_rhs_value))
tem = from_insn;