This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, lra] PR70751, correct the cost for spilling non-pseudo into memory
- From: Dominik Vogt <vogt at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jeff Law <law at redhat dot com>, Jiong Wang <jiong dot wang at foss dot arm dot com>, Vladimir N Makarov <vmakarov at redhat dot com>, Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>, Robin Dapp <rdapp at linux dot vnet dot ibm dot com>
- Date: Mon, 27 Jun 2016 17:26:14 +0100
- Subject: Re: [Patch, lra] PR70751, correct the cost for spilling non-pseudo into memory
- Authentication-results: sourceware.org; auth=none
- References: <cfd17ab9-b740-6516-6212-41361177a8a5 at foss dot arm dot com> <0d4316cc-8ee3-b5cc-9c26-50365ff82201 at redhat dot com>
- Reply-to: vogt at linux dot vnet dot ibm dot com
On Thu, Jun 09, 2016 at 09:52:39AM -0600, Jeff Law wrote:
> On 06/08/2016 10:47 AM, Jiong Wang wrote:
> >As discussed on the PR
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70751,
> >
> >here is the patch.
This commit has introduced an ICE with s390x, march=z13. Is it a
backend bug or one in the middleend?
-- x.c --
void foo(int *n, int off, int *m)
{
int i;
for(i = 0 ;i <= 3; i++)
{
n[off + i] = m[2 * i];
n[off + 7 - i] = m[2 * i + 1];
}
}
-- snip --
$ gcc -S -O3 -march=z13 x.c
x.c: In function âfooâ:
x.c:10:1: internal compiler error: Max. number of generated reload insns per insn is achieved (90)
}
^
0x804c34b7 lra_constraints(bool)
gcc/lra-constraints.c:4468
0x804b085f lra(_IO_FILE*)
gcc/lra.c:2290
0x804690fb do_reload
gcc/ira.c:5384
0x804690fb execute
gcc/ira.c:5568
> >
> >For this particular failure on arm, *arm_movsi_insn has the following
> >operand
> >constraints:
> > operand 0: "=rk,r,r,r,rk,m"
> > operand 1: "rk, I,K,j,mi,rk"
> >
> >gcc won't explicitly refuse an unmatch CT_MEMORY operand (r235184) if it
> >comes from substituion that alternative (alt) 4 got a chance to compete
> >with
> >alt 0, and eventually be the winner as it's with rld_nregs=0 while alt 0 is
> >with rld_nregs=1.
> >
> >I fell it's OK to give alt 4 a chance here, but we should calculate the
> >cost
> >correctly.
> >
> >For alt 4, it should be treated as spill into memory, but currently lra
> >only
> >recognize a spill for pseudo register. While the spilled rtx for alt 4
> >is a
> >plus after equiv substitution.
> >
> > (plus:SI (reg/f:SI 102 sfp)
> > (const_int 4 [0x4]))
> >
> >This patch thus let lra-constraint cost spill of Non-pseudo as well and
> >fixed
> >the regression.
> >
> >x86_64/aarch64/arm boostrap and regression OK.
> >arm bootstrapped cc1 is about 0.3% smaller in code size.
> >
> >OK for trunk?
> >
> >gcc/
> > PR rtl-optimization/70751
> > * lra-constraints.c (process_alt_operands): Recognize Non-pseudo
> >spilled into
> > memory.
> >
> I think the change itself is fine, but the comment could use some
> work. Actually I think you just need to remove the first sentence
> (the one referring to BZ70751 and r235184) and keep everything from
> "Suppose a target" onward.
>
> OK with that fix.
>
> jeff
>
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany