This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Add missing update_stmt to cgraph_redirect_edge_call_stmt_to_callee
On Fri, Apr 16, 2010 at 5:47 PM, Martin Jambor <firstname.lastname@example.org> wrote:
> On Fri, Apr 16, 2010 at 10:57:19AM +0200, Richard Guenther wrote:
>> On Fri, 16 Apr 2010, Martin Jambor wrote:
>> > when investigating an ICE in LTO of 483.xalancbmk with my
>> > devirtualization patches, I have found out that a call to update_stmt
>> > is missing in cgraph_redirect_edge_call_stmt_to_callee. ?It should be
>> > called because the function can replace an SSA target (or an
>> > OBJ_TYPE_REF containg SSAs) with a decl, removing a use or two.
>> > So this patch adds it. ?I have bootstrapped and tested it on
>> > x86_64-linux. ?OK for the trunk and 4.5 branch?
>> Hmm. ?You should assert that !need_ssa_update_p (cfun) after
> cgraph_redirect_edge_call_stmt_to_callee is called from within
> cgraph_materialize_all_clones in cgraphunit.c and from copy_bb in
> tree-inline.c. ?Inlining does mark stuff for renaming and so this can
> be asserted only in the former context. ?And that is exactly what the
> updated patch below does. ?I have re-bootstrapped and re-tested it.
> Is ot OK for trunk and the 4.5 branch now?
Ok for trunk. If you don't have a testcase that exhibits this problem on
the branch leave it alone.
> Thanks for the suggestion,
> 2010-04-16 ?Martin Jambor ?<email@example.com>
> ? ? ? ?* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Update
> ? ? ? ?new_stmt.
> ? ? ? ?(cgraph_materialize_all_clones): Assert !need_ssa_update_p.
> Index: icln/gcc/cgraphunit.c
> --- icln.orig/gcc/cgraphunit.c
> +++ icln/gcc/cgraphunit.c
> @@ -2260,6 +2260,7 @@ cgraph_redirect_edge_call_stmt_to_callee
> ? gsi = gsi_for_stmt (e->call_stmt);
> ? gsi_replace (&gsi, new_stmt, true);
> + ?update_stmt (new_stmt);
> ? /* Update EH information too, just in case. ?*/
> ? maybe_clean_or_replace_eh_stmt (e->call_stmt, new_stmt);
> @@ -2363,6 +2364,7 @@ cgraph_materialize_all_clones (void)
> ? ? ? ? push_cfun (DECL_STRUCT_FUNCTION (node->decl));
> ? ? ? ?for (e = node->callees; e; e = e->next_callee)
> ? ? ? ? ?cgraph_redirect_edge_call_stmt_to_callee (e);
> + ? ? ? gcc_assert (!need_ssa_update_p (cfun));
> ? ? ? ?pop_cfun ();
> ? ? ? ?current_function_decl = NULL;
> ?#ifdef ENABLE_CHECKING