Re: Switch optimization idea

2013-03-22 Thread Steve Ellcey
On Fri, 2013-03-22 at 13:00 -0600, Jeff Law wrote: > There's a BZ for this issue with a bit more state for this issue. > > jeff Found it. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54742 Steve Ellcey sell...@imgtec.com

Re: Switch optimization idea

2013-03-22 Thread Steve Ellcey
On Fri, 2013-03-22 at 13:00 -0600, Jeff Law wrote: > As others have pointed out, this is jump threading. > > The reason you're not seeing jump threading in the CoreMark test is the > switch is inside a loop and threading a backedge is severely constrained. > > There's a BZ for this issue with a

Re: Switch optimization idea

2013-03-22 Thread Jeff Law
On 03/22/2013 11:17 AM, Steve Ellcey wrote: I am looking at implementing a GCC optimization pass based on constant propagation into a switch statement. Given: if (expr) s = 1; codeX; (code that allows definition of s to propogate through)

Re: Switch optimization idea

2013-03-22 Thread Andrew Pinski
On Fri, Mar 22, 2013 at 10:17 AM, Steve Ellcey wrote: > I am looking at implementing a GCC optimization pass based on constant > propagation into a switch statement. > > Given: > > if (expr) > s = 1; > codeX; (code that allows definition of s

Re: Switch optimization idea

2013-03-22 Thread Xinliang David Li
How about finding the single-entry/single exit region that dominates the switch and post-dominates the s assignment. You can then examine if s is modified in the region. David On Fri, Mar 22, 2013 at 10:17 AM, Steve Ellcey wrote: > I am looking at implementing a GCC optimization pass based on c