Re: RFC: Patch for switch elimination (PR 54742)

2014-09-04 Thread Richard Biener
On Thu, Sep 4, 2014 at 3:06 PM, Jakub Jelinek wrote: > On Thu, Sep 04, 2014 at 02:57:47PM +0200, Richard Biener wrote: >> Note that I think we arrived at the point where the loop structure >> has annotations that are required for correctness :/ (simduid >> for example - if that goes away we do ..

Re: RFC: Patch for switch elimination (PR 54742)

2014-09-04 Thread Jakub Jelinek
On Thu, Sep 04, 2014 at 02:57:47PM +0200, Richard Biener wrote: > Note that I think we arrived at the point where the loop structure > has annotations that are required for correctness :/ (simduid > for example - if that goes away we do ...? ICE? generate > wrong code? I don't know - Jakub shou

Re: RFC: Patch for switch elimination (PR 54742)

2014-09-04 Thread Richard Biener
On Wed, Sep 3, 2014 at 11:22 PM, Jeff Law wrote: > On 08/13/14 03:44, Richard Biener wrote: >> >> >> I don't see that this pass should "scrog" a loop beyond repair. Btw, >> the "proper" way of just fixing loops up (assuming that all loop >> headers are still at their appropriate place) is to _jus

Re: RFC: Patch for switch elimination (PR 54742)

2014-09-03 Thread Jeff Law
On 08/13/14 03:44, Richard Biener wrote: I don't see that this pass should "scrog" a loop beyond repair. Btw, the "proper" way of just fixing loops up (assuming that all loop headers are still at their appropriate place) is to _just_ do loops_set_state (LOOPS_NEED_FIXUP). This pass can quite ea

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-15 Thread Ramana Radhakrishnan
On 14/08/14 19:25, Steve Ellcey wrote: On Thu, 2014-08-14 at 10:21 -0600, Jeff Law wrote: On 08/14/14 10:12, David Malcolm wrote: On Thu, 2014-08-14 at 09:56 -0600, Jeff Law wrote: On 08/14/14 04:32, Richard Biener wrote: You'll note in a separate thread Steve and I discussed this during Ca

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-15 Thread Jeff Law
On 08/15/14 04:07, Richard Biener wrote: On Thu, Aug 14, 2014 at 8:45 PM, Sebastian Pop wrote: Steve Ellcey wrote: I understand the desire not to add optimizations just for benchmarks but we do know other compilers have added this optimization for coremark (See http://community.arm.com/groups/

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-15 Thread Richard Biener
On Fri, Aug 15, 2014 at 12:13 PM, Richard Biener wrote: > On Thu, Aug 14, 2014 at 8:25 PM, Steve Ellcey wrote: >> On Thu, 2014-08-14 at 10:21 -0600, Jeff Law wrote: >>> On 08/14/14 10:12, David Malcolm wrote: >>> > On Thu, 2014-08-14 at 09:56 -0600, Jeff Law wrote: >>> >> On 08/14/14 04:32, Richa

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-15 Thread Richard Biener
On Thu, Aug 14, 2014 at 8:25 PM, Steve Ellcey wrote: > On Thu, 2014-08-14 at 10:21 -0600, Jeff Law wrote: >> On 08/14/14 10:12, David Malcolm wrote: >> > On Thu, 2014-08-14 at 09:56 -0600, Jeff Law wrote: >> >> On 08/14/14 04:32, Richard Biener wrote: >> You'll note in a separate thread Steve

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-15 Thread Richard Biener
On Thu, Aug 14, 2014 at 8:45 PM, Sebastian Pop wrote: > Steve Ellcey wrote: >> I understand the desire not to add optimizations just for benchmarks but >> we do know other compilers have added this optimization for coremark >> (See >> http://community.arm.com/groups/embedded/blog/2013/02/21/corema

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-14 Thread Sebastian Pop
Steve Ellcey wrote: > I understand the desire not to add optimizations just for benchmarks but > we do know other compilers have added this optimization for coremark > (See > http://community.arm.com/groups/embedded/blog/2013/02/21/coremark-and-compiler-performance) > and the 13 people on the CC li

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-14 Thread Steve Ellcey
On Thu, 2014-08-14 at 10:21 -0600, Jeff Law wrote: > On 08/14/14 10:12, David Malcolm wrote: > > On Thu, 2014-08-14 at 09:56 -0600, Jeff Law wrote: > >> On 08/14/14 04:32, Richard Biener wrote: > You'll note in a separate thread Steve and I discussed this during > Cauldron > and it

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-14 Thread Steve Ellcey
On Wed, 2014-08-13 at 11:52 +0200, Richard Biener wrote: > On Wed, Aug 13, 2014 at 4:54 AM, Bin.Cheng wrote: > > On Wed, Aug 13, 2014 at 4:40 AM, Jeff Law wrote: > >> On 08/12/14 14:23, Richard Biener wrote: > >>> On August 12, 2014 8:31:16 PM CEST, Jeff Law wrote: > On 08/12/14 11:46, Stev

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-14 Thread David Malcolm
On Thu, 2014-08-14 at 09:56 -0600, Jeff Law wrote: > On 08/14/14 04:32, Richard Biener wrote: > >> You'll note in a separate thread Steve and I discussed this during Cauldron > >> and it was at my recommendation Steve resurrected his proof of concept > >> plugin and started beating it into shape. >

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-14 Thread Jeff Law
On 08/14/14 10:12, David Malcolm wrote: On Thu, 2014-08-14 at 09:56 -0600, Jeff Law wrote: On 08/14/14 04:32, Richard Biener wrote: You'll note in a separate thread Steve and I discussed this during Cauldron and it was at my recommendation Steve resurrected his proof of concept plugin and start

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-14 Thread Jeff Law
On 08/14/14 04:32, Richard Biener wrote: You'll note in a separate thread Steve and I discussed this during Cauldron and it was at my recommendation Steve resurrected his proof of concept plugin and started beating it into shape. But do we really want a pass just to help coremark? And that's th

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-14 Thread Richard Biener
On Wed, Aug 13, 2014 at 11:06 PM, Jeff Law wrote: > On 08/13/14 14:55, Sebastian Pop wrote: >> >> Steve Ellcey wrote: >>> >>> +/* This file implements an optimization where, when a variable is set >>> + to a constant value and there is a path that leads from that >>> definition >>> + to a swit

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-13 Thread Sebastian Pop
Jeff Law wrote: > I'm pretty sure jump threading *could* handle it, but after looking > at the full testcase when it was posted, I'm not sure it's *wise* to > handle this in jump threading. Thanks for clearing my doubts. Sebastian

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-13 Thread Jeff Law
On 08/13/14 14:55, Sebastian Pop wrote: Steve Ellcey wrote: +/* This file implements an optimization where, when a variable is set + to a constant value and there is a path that leads from that definition + to a switch statement that uses that variable as its controlling expression + we du

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-13 Thread Sebastian Pop
Steve Ellcey wrote: > +/* This file implements an optimization where, when a variable is set > + to a constant value and there is a path that leads from that definition > + to a switch statement that uses that variable as its controlling > expression > + we duplicate the blocks on this path

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-13 Thread Richard Biener
On Wed, Aug 13, 2014 at 4:54 AM, Bin.Cheng wrote: > On Wed, Aug 13, 2014 at 4:40 AM, Jeff Law wrote: >> On 08/12/14 14:23, Richard Biener wrote: >>> >>> On August 12, 2014 8:31:16 PM CEST, Jeff Law wrote: On 08/12/14 11:46, Steve Ellcey wrote: > > After talking to Jeff Law at t

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-13 Thread Richard Biener
On Tue, Aug 12, 2014 at 10:40 PM, Jeff Law wrote: > On 08/12/14 14:23, Richard Biener wrote: >> >> On August 12, 2014 8:31:16 PM CEST, Jeff Law wrote: >>> >>> On 08/12/14 11:46, Steve Ellcey wrote: After talking to Jeff Law at the GCC Cauldron I have updated my >>> >>> switch

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-12 Thread Bin.Cheng
On Wed, Aug 13, 2014 at 4:40 AM, Jeff Law wrote: > On 08/12/14 14:23, Richard Biener wrote: >> >> On August 12, 2014 8:31:16 PM CEST, Jeff Law wrote: >>> >>> On 08/12/14 11:46, Steve Ellcey wrote: After talking to Jeff Law at the GCC Cauldron I have updated my >>> >>> switch s

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-12 Thread Steve Ellcey
On Tue, 2014-08-12 at 14:40 -0600, Jeff Law wrote: > On 08/12/14 14:23, Richard Biener wrote: > > On August 12, 2014 8:31:16 PM CEST, Jeff Law wrote: > >> Try setting the header & latch fields for the loop structure to NULL, > >> then call loops_set_state (LOOPS_NEED_FIXUP). > > > > But that is _n

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-12 Thread Jeff Law
On 08/12/14 14:23, Richard Biener wrote: On August 12, 2014 8:31:16 PM CEST, Jeff Law wrote: On 08/12/14 11:46, Steve Ellcey wrote: After talking to Jeff Law at the GCC Cauldron I have updated my switch shortcut plugin pass to try and address this optimization in the hopes of getting it ad

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-12 Thread Richard Biener
On August 12, 2014 8:31:16 PM CEST, Jeff Law wrote: >On 08/12/14 11:46, Steve Ellcey wrote: >> After talking to Jeff Law at the GCC Cauldron I have updated my >switch >> shortcut plugin pass to try and address this optimization in the >hopes of >> getting it added to GCC as a static pass. I fixed

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-12 Thread Jeff Law
On 08/12/14 11:46, Steve Ellcey wrote: After talking to Jeff Law at the GCC Cauldron I have updated my switch shortcut plugin pass to try and address this optimization in the hopes of getting it added to GCC as a static pass. I fixed the code to build with the various C++ changes that have been

Re: RFC: Patch for switch elimination (PR 54742)

2014-08-12 Thread Jakub Jelinek
On Tue, Aug 12, 2014 at 10:46:46AM -0700, Steve Ellcey wrote: > --- /dev/null > +++ b/gcc/tree-switch-shortcut.c > +/* This file implements an optimization where, when a variable is set > + to a constant value and there is a path that leads from this definition > + to a switch statement that us

RFC: Patch for switch elimination (PR 54742)

2014-08-12 Thread Steve Ellcey
After talking to Jeff Law at the GCC Cauldron I have updated my switch shortcut plugin pass to try and address this optimization in the hopes of getting it added to GCC as a static pass. I fixed the code to build with the various C++ changes that have been happening in GCC but the current version