[PATCH] Make cgraph_edge::resolve_speculation static

Jan Hubicka hubicka@ucw.cz
Mon Jan 6 11:47:00 GMT 2020


> Hi,
> 
> throughout this year a few of us got burnt by the fact that
> cgraph_edge::resolve_speculation method sometimes removed and
> deallocated its this pointer, sometimes making the this pointer of a few
> other methods of the class also suddenly invalid.
> 
> We postponed dealing with the issue because simply making these methods
> static would be a bit ugly and hoped that someone would come with
> something better.  Well, that did not happen and so the semi-mechanical
> patch below does exactly that and fixing a few (potential) problems I
> encountered: I made the iteration over edges in
> function_and_variable_visibility cope with such edge removal and fixed
> local variable hiding in cgraph_node::set_call_stmt_including_clones and
> cgraph_node::create_edge_including_clones.  I did not unify calls to
> resolve_speculation and make_direct in redirect_to_unreachable in this
> patch but I believe that is a logical follow-up.
> 
> The patch has passed bootstrap and LTO bootstrap and testing on an
> x86_64-linux.  What do you think?
It looks reasonable to me, but if we do not want member function to
deallocate THIS, then we probably want to make remove()
methods also static?

Honza



More information about the Gcc-patches mailing list