This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR middle-end/28690, indexed load/store performance + reload bug
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: bergner at vnet dot ibm dot com (Peter Bergner)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 6 Dec 2006 15:10:05 +0100 (CET)
- Subject: Re: [PATCH] Fix PR middle-end/28690, indexed load/store performance + reload bug
Peter Bergner wrote:
> Then how about a scheme where we continue to call single_set() as
> we do now. However, if single_set() returns non null and the insn
> is a PARALLEL, then we recursively call eliminate_regs_in_insn() for
> the portion(s) of the PARALLEL not returned by single_set()? That would
> allow this portion of the code to behave as before, while allowing
> the unused portion of the PARALLEL to have it's regs eliminated.
I'm not sure it is necessary to spend a lot of effort trying to fix
up a portion of the PARALLEL is we already know is unused. I assume
the problem occurs in the second half of this if:
if (offset == 0)
{
int num_clobbers;
/* We assume here that if we need a PARALLEL with
CLOBBERs for this assignment, we can do with the
MATCH_SCRATCHes that add_clobbers allocates.
There's not much we can do if that doesn't work. */
PATTERN (insn) = gen_rtx_SET (VOIDmode,
SET_DEST (old_set),
to_rtx);
num_clobbers = 0;
INSN_CODE (insn) = recog (PATTERN (insn), insn, &num_clobbers);
if (num_clobbers)
{
rtvec vec = rtvec_alloc (num_clobbers + 1);
vec->elem[0] = PATTERN (insn);
PATTERN (insn) = gen_rtx_PARALLEL (VOIDmode, vec);
add_clobbers (PATTERN (insn), INSN_CODE (insn));
}
gcc_assert (INSN_CODE (insn) >= 0);
}
/* If we have a nonzero offset, and the source is already
a simple REG, the following transformation would
increase the cost of the insn by replacing a simple REG
with (plus (reg sp) CST). So try only when we already
had a PLUS before. */
else if (plus_src)
{
new_body = old_body;
if (! replace)
{
new_body = copy_insn (old_body);
if (REG_NOTES (insn))
REG_NOTES (insn) = copy_insn_1 (REG_NOTES (insn));
}
PATTERN (insn) = new_body;
old_set = single_set (insn);
XEXP (SET_SRC (old_set), 0) = to_rtx;
XEXP (SET_SRC (old_set), 1) = GEN_INT (offset);
}
else
break;
where it tries to modify the existing single_set.
Why can't we just always re-create a fresh assignment insn from scratch,
as the first part of the if does? Or else, fall through to the common
part of eliminate_regs_in_insn that recurses through all parts of the
insn.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com