Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2017-01-13 Thread Marek Polacek
On Fri, Dec 16, 2016 at 03:16:14PM +0100, Marek Polacek wrote: > On Fri, Dec 16, 2016 at 02:58:59PM +0100, Richard Biener wrote: > > On Fri, Dec 16, 2016 at 2:03 PM, Bernd Schmidt wrote: > > > On 12/16/2016 12:49 PM, Marek Polacek wrote: > > > > > >> But as this testcase

Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2016-12-20 Thread Richard Biener
On Fri, Dec 16, 2016 at 3:16 PM, Marek Polacek wrote: > On Fri, Dec 16, 2016 at 02:58:59PM +0100, Richard Biener wrote: >> On Fri, Dec 16, 2016 at 2:03 PM, Bernd Schmidt wrote: >> > On 12/16/2016 12:49 PM, Marek Polacek wrote: >> > >> >> But as this

Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2016-12-16 Thread Marek Polacek
On Fri, Dec 16, 2016 at 02:58:59PM +0100, Richard Biener wrote: > On Fri, Dec 16, 2016 at 2:03 PM, Bernd Schmidt wrote: > > On 12/16/2016 12:49 PM, Marek Polacek wrote: > > > >> But as this testcase shows, this breaks when the default label shares a > >> label > >> with

Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2016-12-16 Thread Richard Biener
On Fri, Dec 16, 2016 at 2:03 PM, Bernd Schmidt wrote: > On 12/16/2016 12:49 PM, Marek Polacek wrote: > >> But as this testcase shows, this breaks when the default label shares a >> label >> with another case. On this testcase, when we reach the switch, we know >> that >>

Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2016-12-16 Thread Bernd Schmidt
On 12/16/2016 12:49 PM, Marek Polacek wrote: But as this testcase shows, this breaks when the default label shares a label with another case. On this testcase, when we reach the switch, we know that argc is either 1, 2, or 3. So by the time we reach vrp2, the IR will have been optimized to

Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2016-12-16 Thread Marek Polacek
On Fri, Dec 16, 2016 at 02:00:56PM +0100, Richard Biener wrote: > On Fri, Dec 16, 2016 at 12:49 PM, Marek Polacek wrote: > > --- gcc/tree-vrp.c > > +++ gcc/tree-vrp.c > > @@ -6051,10 +6051,17 @@ find_switch_asserts (basic_block bb, gswitch *last) > >/* Now register along

Re: [PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2016-12-16 Thread Richard Biener
On Fri, Dec 16, 2016 at 12:49 PM, Marek Polacek wrote: > Starting with r238761, we register assertions for default switch labels; > these assertions correspond to the anti-range of each case label. It > means that we can optimize this better: > > switch (i) { > case 1:

[PATCH] Fix assertions along default switch labels (PR tree-optimization/78819)

2016-12-16 Thread Marek Polacek
Starting with r238761, we register assertions for default switch labels; these assertions correspond to the anti-range of each case label. It means that we can optimize this better: switch (i) { case 1: case 2: case 3: ... break; default: // i is ~[1, 3] if (i