[PATCH] Fix fold_stmt ICE (PR c++/49264)
Jakub Jelinek
jakub@redhat.com
Mon Jun 6 11:19:00 GMT 2011
On Mon, Jun 06, 2011 at 11:30:19AM +0200, Richard Guenther wrote:
> On Fri, Jun 3, 2011 at 3:55 PM, Jakub Jelinek <jakub@redhat.com> 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
More information about the Gcc-patches
mailing list