This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PING Updated]: [PATCH GCC/ARM] Fix problem that hardreg_cprop opportunities are missed on thumb1
- From: "Bin Cheng" <bin dot cheng at arm dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Cc: "Ramana Radhakrishnan" <Ramana dot Radhakrishnan at arm dot com>, "Richard Earnshaw" <Richard dot Earnshaw at arm dot com>, "'Richard Sandiford'" <rdsandiford at googlemail dot com>
- Date: Mon, 8 Oct 2012 14:35:37 +0800
- Subject: RE: [PING Updated]: [PATCH GCC/ARM] Fix problem that hardreg_cprop opportunities are missed on thumb1
- References: <005001cd793a$4e8956e0$eb9c04a0$@cheng@arm.com> <5045d229.8208b40a.1602.ffffde72SMTPIN_ADDED@mx.google.com> <87627t5tll.fsf@talisman.home> <009601cd9af3$c3049400$490dbc00$@cheng@arm.com>
Ping.
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-owner@gcc.gnu.org]
On
> Behalf Of Bin Cheng
> Sent: Tuesday, September 25, 2012 4:00 PM
> To: 'Richard Sandiford'
> Cc: Ramana Radhakrishnan; Richard Earnshaw; gcc-patches@gcc.gnu.org
> Subject: RE: [Updated]: [PATCH GCC/ARM] Fix problem that hardreg_cprop
> opportunities are missed on thumb1
>
>
> > -----Original Message-----
> > From: Richard Sandiford [mailto:rdsandiford@googlemail.com]
> > Sent: Wednesday, September 05, 2012 6:09 AM
> > To: Bin Cheng
> > Cc: Ramana Radhakrishnan; 'Eric Botcazou'; gcc-patches@gcc.gnu.org
> > Subject: Re: Ping: [PATCH GCC/ARM] Fix problem that hardreg_cprop
> > opportunities are missed on thumb1
>
> > Subtraction of zero isn't canonical rtl though. Passes after
> > peephole2
> would
> > be well within their rights to simplify the expression back to a move.
> > From that point of view, making the passes recognise (plus X 0) and
> > (minus
> X 0)
> > as special cases would be inconsistent.
> >
> > Rather than make the Thumb 1 CC usage implicit in the rtl stream, and
> carry
> > the current state around in cfun->machine, it seems like it would be
> better to
> > get md_reorg to rewrite the instructions into a form that makes the
> > use of condition codes explicit.
> >
> > md_reorg also sounds like a better place in the pipeline than
> > peephole2 to
> be
> > doing this kind of transformation, although I admit I have zero
> > evidence
> to
> > back that up...
> >
>
> Hi Richard,
>
> This is the updated patch according to your suggestions. I removed the
> peephole2 patterns and introduced function thumb1_reorg to rewrite
> instructions in md_reorg pass.
>
> In addition to missed propagation, this patch also detects following case:
> mov r5, r0
> str r0, [r4] <-------miscellaneous irrelevant instructions
> [cmp r0, 0] <-------saved
> bne .Lxxx
>
> Patch tested on arm-none-eabi/cortex-m0, no regressions introduced.
>
> Is it OK?
>
> Thanks.
>
> 2012-09-25 Bin Cheng <bin.cheng@arm.com>
>
> * config/arm/arm.c (thumb1_reorg): New function.
> (arm_reorg): Call thumb1_reorg.
> (thumb1_final_prescan_insn): Record src operand in thumb1_cc_op0.
> * config/arm/arm.md : Remove peephole2 patterns which rewrites move
> into subtract of ZERO.