Re: rfc: another switch optimization idea

2013-03-28 Thread Dinar Temirbulatov
sorry, The numbers were too good, something was wrong in my setup. thanks, Dinar, >> before: >>Base Base Base Peak >> Peak Peak >>BenchmarksRef Time Run Time RatioRef Time Run Time Ratio >>---

Re: rfc: another switch optimization idea

2013-03-26 Thread Steven Bosscher
On Tue, Mar 26, 2013 at 10:31 AM, Richard Biener wrote: > On Mon, Mar 25, 2013 at 10:23 PM, Dinar Temirbulatov wrote: >> The error in 252.eon was due to incorrect setup. Also "if (count > >> 3*PARAM_VALUE (PARAM_SWITCH_JUMP_TABLES_BB_OPS_LIMIT))" does not look >> correct, and probably it is better

Re: rfc: another switch optimization idea

2013-03-26 Thread Richard Biener
On Mon, Mar 25, 2013 at 10:23 PM, Dinar Temirbulatov wrote: > Hi, > We noticed some performance gains if we are not using jump over some > simple switch statements. Here is the idea: Check whether the switch > statement can be expanded with conditional instructions. In that case > jump tables shou

Re: rfc: another switch optimization idea

2013-03-25 Thread Ondřej Bílka
On Tue, Mar 26, 2013 at 01:23:58AM +0400, Dinar Temirbulatov wrote: > Hi, > We noticed some performance gains if we are not using jump over some > simple switch statements. Here is the idea: Check whether the switch > statement can be expanded with conditional instructions. In that case > jump tabl

rfc: another switch optimization idea

2013-03-25 Thread Dinar Temirbulatov
Hi, We noticed some performance gains if we are not using jump over some simple switch statements. Here is the idea: Check whether the switch statement can be expanded with conditional instructions. In that case jump tables should be avoided since some branch instructions can be eliminated in furth

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

Switch optimization idea

2013-03-22 Thread Steve Ellcey
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) switch (s) {