On Fri, 15 Mar 2019, Jakub Jelinek wrote:

> On Fri, Mar 15, 2019 at 09:22:26AM +0100, Richard Biener wrote:
> > That said, I think we can go with my patch for GCC 9 and defer a more
> > complete and elaborate solution to GCC 10 (where I'd still prefer
> > sth simple).
> > 
> > What do you think?
> 
> Ok.  gimple_purge_dead_abnormal_call_edges after all isn't that expensive,
> it just walks over all successor edges of a bb.
> Right now gimple_purge_all_dead_abnormal_call_edges is only called by
> sccvn on specific bbs that do need ab cleanup, tree-inline.c calls
> gimple_purge_dead_abnormal_call_edges only if it is inlining a call at the
> end of a bb and tree-cfg.c calls it for const/pure calls.
> 
> In that last case, I wonder if we actually shouldn't do following, because
> it makes no sense to call it for each constant/pure call in a bb when all we
> care about is whether it is the last stmt that is a pure/const call.

Sure.  Though I think with us now having gimple_call_set_ctrl_altering
execute_fixup_cfg can be stripped down considerably - possibly simply
leaving most parts to CFG cleanup.  The noreturn fixup is still
required if a call becomes known to not return (CFG cleanup only
looks at the last stmt), but gimple_purge_dead_abnormal_call_edges can
be completely elided IMHO (just schedule CFG cleanup).

Richard.

> --- gcc/tree-cfg.c.jj 2019-03-14 23:44:27.861560155 +0100
> +++ gcc/tree-cfg.c    2019-03-15 09:37:15.667785016 +0100
> @@ -9483,7 +9483,8 @@ execute_fixup_cfg (void)
>             int flags = gimple_call_flags (stmt);
>             if (flags & (ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE))
>               {
> -               if (gimple_purge_dead_abnormal_call_edges (bb))
> +               if (gsi_one_before_end_p (gsi)
> +                   && gimple_purge_dead_abnormal_call_edges (bb))
>                   todo |= TODO_cleanup_cfg;
>  
>                 if (gimple_in_ssa_p (cfun))
> 
> 
>       Jakub
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)

Reply via email to