On Mon, Jun 06, 2011 at 11:30:19AM +0200, Richard Guenther wrote:
> On Fri, Jun 3, 2011 at 3:55 PM, Jakub Jelinek <[email protected]> wrote:
> > --- gcc/tree-inline.c.jj 2011-06-02 10:15:20.000000000 +0200
> > +++ gcc/tree-inline.c 2011-06-03 09:29:15.000000000 +0200
> > @@ -4108,6 +4108,14 @@ fold_marked_statements (int first, struc
> > if (fold_stmt (&gsi))
> > {
> > gimple new_stmt;
> > + /* If a builtin at the end of a bb folded into
> > nothing,
> > + the following loop won't work. */
> > + if (gsi_end_p (gsi))
> > + {
> > + cgraph_update_edges_for_call_stmt (old_stmt,
> > old_decl,
> > +
> > gimple_build_nop ());
>
> This? Esp. I don't like the gimple_build_nop () here too much.
Yeah, I've talked about it in my patch comment.
E.g. cgraph_update_edges_for_call_stmt could accept NULL as new_stmt, or we
could add e.g.
void
cgraph_remove_edges_for_call_stmt (gimple old_stmt)
{
struct cgraph_node *orig = cgraph_get_node (cfun->decl);
struct cgraph_node *node;
struct cgraph_edge *e;
gcc_checking_assert (orig);
e = cgraph_edge (orig, old_stmt);
if (e)
cgraph_remove_edge (e);
if (orig->clones)
for (node = orig->clones; node != orig; )
{
e = cgraph_edge (node, old_stmt);
if (e)
cgraph_remove_edge (e);
if (node->clones)
node = node->clones;
else if (node->next_sibling_clone)
node = node->next_sibling_clone;
else
{
while (node != orig && !node->next_sibling_clone)
node = node->clone_of;
if (node != orig)
node = node->next_sibling_clone;
}
}
}
I think NULL new_stmt would have the advantage that we wouldn't duplicate
the complex code looping through all kinds of clones.
Jakub