This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH RFA] tree-optimization/PR43491, Unnecessary temporary for global register variable
- From: "Bin Cheng" <bin dot cheng at arm dot com>
- To: "'Ye Joey'" <joey dot ye dot cc at gmail dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>, <richard dot guenther at gmail dot com>
- Date: Fri, 23 Dec 2011 13:35:46 +0800
- Subject: RE: [PATCH RFA] tree-optimization/PR43491, Unnecessary temporary for global register variable
- References: <4ef28f28.c430440a.28b2.0dfdSMTPIN_ADDED@mx.google.com> <CAL0py24Lj7nSmgozWpULt7L-TWgCbKKfzON5jan_Jmv2oW8a4A@mail.gmail.com> <000c01ccc126$ec4dee30$c4e9ca90$@cheng@arm.com>
Also the test case does not write rbp, so I guess it's ok to use rbp too.
Thanks
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-owner@gcc.gnu.org]
On
> Behalf Of Bin Cheng
> Sent: Friday, December 23, 2011 11:57 AM
> To: 'Ye Joey'
> Cc: gcc-patches@gcc.gnu.org; richard.guenther@gmail.com
> Subject: RE: [PATCH RFA] tree-optimization/PR43491, Unnecessary temporary
for
> global register variable
>
> I tested the test case with "r13" which is another callee saved register,
> I think it's ok to replace.
>
> Thanks
>
> > -----Original Message-----
> > From: Ye Joey [mailto:joey.ye.cc@gmail.com]
> > Sent: Friday, December 23, 2011 11:25 AM
> > To: Bin Cheng
> > Cc: gcc-patches@gcc.gnu.org; richard.guenther@gmail.com
> > Subject: Re: [PATCH RFA] tree-optimization/PR43491, Unnecessary
temporary
> for
> > global register variable
> >
> > Writing to rbp will damage stack frame. Though it is a compile only
> > case, better not to write rbp.
> >
> > OK to s/rbp/r13 when commit it?
> >
> > - Joey
> >
> > On Thu, Dec 22, 2011 at 9:59 AM, Bin Cheng <bin.cheng@arm.com> wrote:
> > > Hi,
> > >
> > > This patch fixes the bug PR43491, which exists at least on
> > > arm-none-eabi/mips-elf
> > > targets.
> > >
> > > The cause is ssa-pre eliminates global register variable when it is
the
> RHS
> > > of
> > > single assign statment, while following passes do not handle the
> > > const/register
> > > attributes of the variable.
> > >
> > > This patch skips the elimination of global register variable when it
is
> the
> > > RHS
> > > of a single assignment in SSA-PRE pass.
> > >
> > > By doing this,
> > >
> > > 0) gcc won't generate the redundant move instruction as reported in
the
> bug.
> > > 1) normal redundancy elimination on global registers will not be hurt,
> > > ? since sccvn and pre has already detected the true elimination
chances
> > > ? and they will be eliminated afterward in function eliminate.
> > > 2) the inserted statements(including PHIs) for global register
variables
> > > ? will not be marked as NECESSARY in function eliminate and will be
> > > ? deleted in remove_dead_inserted_code. So no redundant insertions
will
> be
> > > ? generated in PRE pass.
> > >
> > > Some discussion can be found at:
> > > ?http://gcc.gnu.org/ml/gcc/2011-12/msg00000.html
> > >
> > > The patch is tested on x86 and arm-none-eabi, no failure introduced.
> > >
> > > Is it OK?
> > >
> > > Thanks
> > >
> > > gcc/ChangeLog:
> > > 2011-12-21 ?Bin Cheng ?<bin.cheng@arm.com>
> > > ? ? ? ? ? ?Richard Guenther ?<rguenther@suse.de>
> > >
> > > ? ? ? ?PR tree-optimization/43491
> > > ? ? ? ?* tree-ssa-pre.c (eliminate): Don't replace global register
> variable
> > > when
> > > ? ? ? ?it is the RHS of a single assign.
> > >
> > > gcc/testsuite/ChangeLog:
> > > 2011-12-21 ?Bin Cheng ?<bin.cheng@arm.com>
> > >
> > > ? ? ? ?PR tree-optimization/43491
> > > ? ? ? ?* gcc.dg/tree-ssa/pr43491.c: New test.
>
>
>
>