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 (*entry_edge);
> >+
> >    free_dominance_info (CDI_DOMINATORS);
> >  }
> 
> Not sure I like creating a fallthru edge and then calling 
> force_nonfallthru on it.

It's just to create the edge and a branch, and to set all flags and the
edge probability etc. correctly for it.  (You have to first make it
EDGE_FALLTHRU or force_nonfallthru will complain).  Is there a nicer
idiom, or a helper function?  Should there be?

> Have a look at emit_to_new_bb_before in 
> except.c which does something similar - it creates the new block before 
> the one into which it wants to fall thru, and modifies a potential 
> existing fallthru edge. I'd like that better; please change the patch if 
> you also agree. Otherwise ok.

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).


Segher

Reply via email to