This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH RFA] tree-optimization/PR43491, Unnecessary temporary for global register variable


On Thu, Dec 22, 2011 at 2: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?

Ok.

Thanks,
Richard.

> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]