aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@gcc.gnu.org>2014-03-28 22:19:27 +0000
committerJan Hubicka <hubicka@gcc.gnu.org>2014-03-28 22:19:27 +0000
commit1f91035fef4b9b43a47de29a925fb4638f322120 (patch)
treea81ad361ae68752cb362377a7ef5130fe2dddcb9 /gcc/cgraph.c
parent6e071b1e8f9902b8c65db6ca3349964a39d1651b (diff)
downloadgcc-1f91035fef4b9b43a47de29a925fb4638f322120.zip
gcc-1f91035fef4b9b43a47de29a925fb4638f322120.tar.gz
gcc-1f91035fef4b9b43a47de29a925fb4638f322120.tar.bz2
cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Clear static chain if needed.
* cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Clear static chain if needed. * g++.dg/torture/pr60659.C: New testcase. From-SVN: r208927
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 3b76aa4..dcab984 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1488,6 +1488,14 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
gsi_insert_before (&gsi, set_stmt, GSI_SAME_STMT);
}
gimple_call_set_lhs (new_stmt, NULL_TREE);
+ update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt);
+ }
+
+ /* If new callee has no static chain, remove it. */
+ if (gimple_call_chain (new_stmt) && !DECL_STATIC_CHAIN (e->callee->decl))
+ {
+ gimple_call_set_chain (new_stmt, NULL);
+ update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt);
}
cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt, false);