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...@gmail.com]
> Sent: Friday, December 23, 2011 11:25 AM
> To: Bin Cheng
> Cc: gcc-patches@gcc.gnu.org; richard.guent...@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.ch...@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.ch...@arm.com>
> >            Richard Guenther  <rguent...@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.ch...@arm.com>
> >
> >        PR tree-optimization/43491
> >        * gcc.dg/tree-ssa/pr43491.c: New test.




Reply via email to