Re: Merge switch statements in tree-cfgcleanup

2016-07-22 Thread Jeff Law
On 07/22/2016 07:13 AM, Richard Biener wrote: + if (dom_info_available_p (CDI_DOMINATORS)) I think DOM info is always available during CFG cleanup My recollection is that the cfg cleanup routines start by removing unreachables, then recomputing the dominator tree if it's not available. That

Re: Merge switch statements in tree-cfgcleanup

2016-07-22 Thread Richard Biener
On Wed, Jul 20, 2016 at 6:26 PM, Bernd Schmidt wrote: > On 07/20/2016 06:09 PM, Jeff Law wrote: >> >> So I'm going to let Richi run with the review on this one since the two >> of you are already iterating. But I did have one comment on the >> placement of the pass. >> >> I believe one of the key

Re: Merge switch statements in tree-cfgcleanup

2016-07-20 Thread Bernd Schmidt
On 07/20/2016 06:09 PM, Jeff Law wrote: So I'm going to let Richi run with the review on this one since the two of you are already iterating. But I did have one comment on the placement of the pass. I believe one of the key things to consider for whether or not something like this belongs in th

Re: Merge switch statements in tree-cfgcleanup

2016-07-20 Thread Jeff Law
On 07/20/2016 05:14 AM, Bernd Schmidt wrote: On 07/19/2016 01:18 PM, Richard Biener wrote: On Tue, Jul 19, 2016 at 1:07 PM, Bernd Schmidt wrote: On 07/19/2016 12:35 PM, Richard Biener wrote: I think that start/end_recording_case_labels also merged adjacent labels via group_case_labels_stmt.

Re: Merge switch statements in tree-cfgcleanup

2016-07-20 Thread Bernd Schmidt
On 07/19/2016 01:18 PM, Richard Biener wrote: On Tue, Jul 19, 2016 at 1:07 PM, Bernd Schmidt wrote: On 07/19/2016 12:35 PM, Richard Biener wrote: I think that start/end_recording_case_labels also merged adjacent labels via group_case_labels_stmt. Not sure why you need to stop recording case

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Richard Biener
On Tue, Jul 19, 2016 at 1:07 PM, Bernd Schmidt wrote: > On 07/19/2016 12:35 PM, Richard Biener wrote: > >> I think that start/end_recording_case_labels also merged adjacent labels >> via group_case_labels_stmt. Not sure why you need to stop recording >> case labels during the transform. Is this

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Bernd Schmidt
On 07/19/2016 12:35 PM, Richard Biener wrote: I think that start/end_recording_case_labels also merged adjacent labels via group_case_labels_stmt. Not sure why you need to stop recording case labels during the transform. Is this because you are building a new switch stmt? It's because the ca

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Richard Biener
On Tue, Jul 19, 2016 at 12:25 PM, Bernd Schmidt wrote: > On 07/19/2016 12:22 PM, Marc Glisse wrote: >> >> On Tue, 19 Jul 2016, Bernd Schmidt wrote: >> >>> On 07/19/2016 12:09 PM, Richard Biener wrote: >>> I saw walks over stmts of a BB. IMHO that's a no-go. >>> >>> >>> Only to find the first

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Bernd Schmidt
On 07/19/2016 12:22 PM, Marc Glisse wrote: On Tue, 19 Jul 2016, Bernd Schmidt wrote: On 07/19/2016 12:09 PM, Richard Biener wrote: I saw walks over stmts of a BB. IMHO that's a no-go. Only to find the first or last nondebug one. Is that unacceptable? Does gsi_start_nondebug_after_labels_

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Marc Glisse
On Tue, 19 Jul 2016, Bernd Schmidt wrote: On 07/19/2016 12:09 PM, Richard Biener wrote: I saw walks over stmts of a BB. IMHO that's a no-go. Only to find the first or last nondebug one. Is that unacceptable? Does gsi_start_nondebug_after_labels_bb not fit? -- Marc Glisse

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Bernd Schmidt
On 07/19/2016 12:09 PM, Richard Biener wrote: I saw walks over stmts of a BB. IMHO that's a no-go. Only to find the first or last nondebug one. Is that unacceptable? I'm thinking of switch (a) { ... case n: do-stuff; default: switch (a) { case n:

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Richard Biener
On Tue, Jul 19, 2016 at 11:52 AM, Bernd Schmidt wrote: > On 07/19/2016 10:07 AM, Richard Biener wrote: >> >> >> This is not appropriate for CFG cleanup due to its complexity not >> being O(# bbs + # edges). >> I tried hard in the past to make it so (at least when no transform is >> done). > > > Wh

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Bernd Schmidt
On 07/19/2016 10:07 AM, Richard Biener wrote: This is not appropriate for CFG cleanup due to its complexity not being O(# bbs + # edges). I tried hard in the past to make it so (at least when no transform is done). Why wouldn't it be, if no transform is done? Assuming we visit each bb once, w

Re: Merge switch statements in tree-cfgcleanup

2016-07-19 Thread Richard Biener
On Mon, Jul 18, 2016 at 6:07 PM, Bernd Schmidt wrote: > The motivating example for this patch was a change that was submitted for > genattrtab last year, which would have made us generate > > switch (type = get_attr_type (insn)) > { >... some cases ... >default: > switch (type = get

Merge switch statements in tree-cfgcleanup

2016-07-18 Thread Bernd Schmidt
The motivating example for this patch was a change that was submitted for genattrtab last year, which would have made us generate switch (type = get_attr_type (insn)) { ... some cases ... default: switch (type = get_attr_type (insn))) { ... some other cases ...