Re: [PATCH] shrink-wrap: Handle multiple predecessors of prologue

2015-09-22 Thread Segher Boessenkool
On Tue, Sep 22, 2015 at 11:11:47AM -0500, Segher Boessenkool wrote: > > So, given that your solution seems to work, the patch is ok. > > Thanks! Here is what I will commit after bootstrap+test (the superfluous > assert removed, and the comment for the code quoted above tweaked a bit). I added th

Re: [PATCH] shrink-wrap: Handle multiple predecessors of prologue

2015-09-22 Thread Segher Boessenkool
On Tue, Sep 22, 2015 at 05:47:25PM +0200, Bernd Schmidt wrote: > On 09/21/2015 04:01 PM, Segher Boessenkool wrote: > >On Mon, Sep 21, 2015 at 01:56:28PM +0200, Bernd Schmidt wrote: > >>>+ basic_block new_bb = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN > >>>(cfun)->prev_bb); > >>>+ BB_COPY_PARTITION (

Re: [PATCH] shrink-wrap: Handle multiple predecessors of prologue

2015-09-22 Thread Bernd Schmidt
On 09/21/2015 04:01 PM, Segher Boessenkool wrote: On Mon, Sep 21, 2015 at 01:56:28PM +0200, Bernd Schmidt wrote: + basic_block new_bb = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb); + BB_COPY_PARTITION (new_bb, pro); [...] + *entry_edge = make_single_succ_edge (new_bb, pro, EDGE_

Re: [PATCH] shrink-wrap: Handle multiple predecessors of prologue

2015-09-21 Thread Bernd Schmidt
We might not be able to redirect the jump from the block formerly the predecessor of PRO, to jump over the new block (it was not necessarily a fallthrough edge, could be EDGE_COMPLEX). In most cases we could do it of course. I would prefer not to add special case code (that is not as well tested

Re: [PATCH] shrink-wrap: Handle multiple predecessors of prologue

2015-09-21 Thread Segher Boessenkool
On Mon, Sep 21, 2015 at 01:56:28PM +0200, Bernd Schmidt wrote: > >+ basic_block new_bb = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN > >(cfun)->prev_bb); > >+ BB_COPY_PARTITION (new_bb, pro); > [...] > >+ *entry_edge = make_single_succ_edge (new_bb, pro, EDGE_FALLTHRU); > >+ force_nonfallthru (*ent

Re: [PATCH] shrink-wrap: Handle multiple predecessors of prologue

2015-09-21 Thread Bernd Schmidt
On 09/18/2015 05:36 PM, Segher Boessenkool wrote: { + while (pro != entry && !can_get_prologue (pro, prologue_clobbered)) + { + gcc_assert (pro != entry); Lose the assert, it's redundant with the loop condition. + basic_block new_bb = create_empty_bb (EXIT_BLOCK_PTR_

[PATCH] shrink-wrap: Handle multiple predecessors of prologue

2015-09-18 Thread Segher Boessenkool
The caller of try_shrink_wrapping wants to be returned a single edge to put the prologue on. To make that work even if there are multiple edges (all pointing to the PRO block) that need the prologue, add a new block that becomes the destination of all such edges, and then jumps to PRO. In the gen