This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, PR 46823] Redirect calls to aliases according to cgraph_edges too
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 13 Jan 2011 00:04:33 +0100
- Subject: [PATCH, PR 46823] Redirect calls to aliases according to cgraph_edges too
Hi,
the problem in PR 46823 is that because
cgraph_redirect_edge_call_stmt_to_callee tries to avoid seemingly
unnecessary work of redirecting a call to a same_body_alias, we have
stray same_body_alias function declarations still lurking in the IL
for which then cgraph_node() function lazily (and wrongly) creates new
nodes which triggers a call graph verifier failure. More details on
the exact mechanism are in bugzilla.
This can be fixed either by simply redirecting these calls to the
callee declarations of the real nodes too or hacked around in
tree-inline (patch doing that is in bugzilla too). Nevertheless, the
always redirecting approach is more principled (it's really better to
do the redirections at fewest places possible) and the overhead should
not be that big.
Unfortunately, so far I have not had much luck with creating a
standalone, small testcase.
Nevertheless, I have bootstrapped and tested the patch below on
x86_64-linx. Is OK for trunk?
Thanks,
Martin
2011-01-12 Martin Jambor <mjambor@suse.cz>
PR middle-end/46823
* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Update also
calls aliases.
Index: icln/gcc/cgraphunit.c
===================================================================
--- icln.orig/gcc/cgraphunit.c
+++ icln/gcc/cgraphunit.c
@@ -2155,9 +2155,7 @@ cgraph_redirect_edge_call_stmt_to_callee
#endif
if (e->indirect_unknown_callee
- || decl == e->callee->decl
- /* Don't update call from same body alias to the real function. */
- || (decl && cgraph_get_node (decl) == cgraph_get_node (e->callee->decl)))
+ || decl == e->callee->decl)
return e->call_stmt;
#ifdef ENABLE_CHECKING