Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-13 Thread Richard Biener
On Mon, 13 May 2019, Segher Boessenkool wrote: > On Sun, May 12, 2019 at 10:07:28PM -0500, Jiufu Guo wrote: > > To elimiate the instructions which moving result of CMP to GPR, I'm > > wondering maybe we could do a combine(or a peephole) after bbro to let > > the condition jump directly using the r

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-13 Thread Segher Boessenkool
On Sun, May 12, 2019 at 10:07:28PM -0500, Jiufu Guo wrote: > To elimiate the instructions which moving result of CMP to GPR, I'm > wondering maybe we could do a combine(or a peephole) after bbro to let > the condition jump directly using the result of CMP. It will have to be a peephole. And peeph

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-12 Thread Jiufu Guo
Jeff Law writes: > On 5/8/19 6:20 AM, Richard Biener wrote: >> On Wed, 8 May 2019, Jiufu Guo wrote: >> >> The main thing the transform does is tail-duplicate the PHI block, >> if we'd just do that followup transforms would do the rest. > One might even claim this is really a transformation for c

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-09 Thread Jeff Law
On 5/9/19 12:07 AM, Richard Biener wrote: > On Wed, 8 May 2019, Jeff Law wrote: > >> On 5/8/19 6:20 AM, Richard Biener wrote: >>> On Wed, 8 May 2019, Jiufu Guo wrote: >>> Hi, Thanks Richard, Segher, Andrew and all. Segher Boessenkool writes: > Let me try to answe

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Richard Biener
On Wed, 8 May 2019, Jeff Law wrote: > On 5/8/19 6:20 AM, Richard Biener wrote: > > On Wed, 8 May 2019, Jiufu Guo wrote: > > > >> Hi, > >> > >> Thanks Richard, Segher, Andrew and all. > >> > >> Segher Boessenkool writes: > >> > >>> Let me try to answer some of this... > >>> > >>> On Tue, May 07,

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Jiufu Guo
Jeff Law writes: > On 5/6/19 8:24 AM, Jiufu Guo wrote: >> Hi, >> >> This patch implements the optimization in PR77820. The optimization >> eliminates phi and phi's basic block, if the phi is used only by >> condition branch, and the phi's incoming value in the result of a >> CMP result. >> >>

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Jeff Law
On 5/6/19 8:24 AM, Jiufu Guo wrote: > Hi, > > This patch implements the optimization in PR77820. The optimization > eliminates phi and phi's basic block, if the phi is used only by > condition branch, and the phi's incoming value in the result of a > CMP result. > > This optimization eliminates:

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Jeff Law
On 5/8/19 6:20 AM, Richard Biener wrote: > On Wed, 8 May 2019, Jiufu Guo wrote: > >> Hi, >> >> Thanks Richard, Segher, Andrew and all. >> >> Segher Boessenkool writes: >> >>> Let me try to answer some of this... >>> >>> On Tue, May 07, 2019 at 03:31:27PM +0200, Richard Biener wrote: On Mon,

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Richard Biener
On Wed, 8 May 2019, Segher Boessenkool wrote: > On Wed, May 08, 2019 at 02:20:19PM +0200, Richard Biener wrote: > > Btw, I wonder if on RTL basic-block reordering (which also does > > some tail duplication) could be a place to do such transform? > > Or is it too late to do the desired cleanups aft

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Segher Boessenkool
On Wed, May 08, 2019 at 02:20:19PM +0200, Richard Biener wrote: > Btw, I wonder if on RTL basic-block reordering (which also does > some tail duplication) could be a place to do such transform? > Or is it too late to do the desired cleanups after that? > Possibly since we're after RA. It is *much*

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Richard Biener
On Wed, 8 May 2019, Jiufu Guo wrote: > Hi, > > Thanks Richard, Segher, Andrew and all. > > Segher Boessenkool writes: > > > Let me try to answer some of this... > > > > On Tue, May 07, 2019 at 03:31:27PM +0200, Richard Biener wrote: > >> On Mon, 6 May 2019, Jiufu Guo wrote: > >> > This patch i

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-08 Thread Richard Biener
On Tue, 7 May 2019, Andrew Pinski wrote: > On Mon, May 6, 2019 at 7:24 AM Jiufu Guo wrote: > > > > Hi, > > > > This patch implements the optimization in PR77820. The optimization > > eliminates phi and phi's basic block, if the phi is used only by > > condition branch, and the phi's incoming val

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-07 Thread Jiufu Guo
Hi, Thanks Richard, Segher, Andrew and all. Segher Boessenkool writes: > Let me try to answer some of this... > > On Tue, May 07, 2019 at 03:31:27PM +0200, Richard Biener wrote: >> On Mon, 6 May 2019, Jiufu Guo wrote: >> > This patch implements the optimization in PR77820. The optimization >>

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-07 Thread Andrew Pinski
On Mon, May 6, 2019 at 7:24 AM Jiufu Guo wrote: > > Hi, > > This patch implements the optimization in PR77820. The optimization > eliminates phi and phi's basic block, if the phi is used only by > condition branch, and the phi's incoming value in the result of a > CMP result. > > This optimizatio

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-07 Thread Segher Boessenkool
Let me try to answer some of this... On Tue, May 07, 2019 at 03:31:27PM +0200, Richard Biener wrote: > On Mon, 6 May 2019, Jiufu Guo wrote: > > This patch implements the optimization in PR77820. The optimization > > eliminates phi and phi's basic block, if the phi is used only by > > condition br

Re: [PATCH] Eliminates phi on branch for CMP result

2019-05-07 Thread Richard Biener
On Mon, 6 May 2019, Jiufu Guo wrote: > Hi, > > This patch implements the optimization in PR77820. The optimization > eliminates phi and phi's basic block, if the phi is used only by > condition branch, and the phi's incoming value in the result of a > CMP result. > > This optimization eliminate

[PATCH] Eliminates phi on branch for CMP result

2019-05-06 Thread Jiufu Guo
Hi, This patch implements the optimization in PR77820. The optimization eliminates phi and phi's basic block, if the phi is used only by condition branch, and the phi's incoming value in the result of a CMP result. This optimization eliminates: 1. saving CMP result: p0 = a CMP b. 2. additional C