aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2017-03-30 15:51:02 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2017-03-30 15:51:02 +0200
commitb0fd4d7e328f0b967d61fdfe44b5e01b26cf3c30 (patch)
tree0d0aa00b6327fc3693098541fb8b4b3c966bfa64 /gcc/cgraph.c
parentde008ec4d69a5f7e9b75b25dc9e1fa937d65ff80 (diff)
downloadgcc-b0fd4d7e328f0b967d61fdfe44b5e01b26cf3c30.zip
gcc-b0fd4d7e328f0b967d61fdfe44b5e01b26cf3c30.tar.gz
gcc-b0fd4d7e328f0b967d61fdfe44b5e01b26cf3c30.tar.bz2
[PR 77333] Fixup fntypes of gimple calls of clones
2017-03-30 Martin Jambor <mjambor@suse.cz> PR ipa/77333 * cgraph.h (cgraph_build_function_type_skip_args): Declare. * cgraph.c (redirect_call_stmt_to_callee): Set gimple fntype so that it reflects the signature changes performed at the callee side. * cgraphclones.c (build_function_type_skip_args): Make public, renamed to cgraph_build_function_type_skip_args. (build_function_decl_skip_args): Adjust call to the above function. testsuite/ * g++.dg/ipa/pr77333.C: New test. From-SVN: r246589
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 8393884..92ae091 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1424,8 +1424,23 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
if (skip_bounds)
new_stmt = chkp_copy_call_skip_bounds (new_stmt);
+ tree old_fntype = gimple_call_fntype (e->call_stmt);
gimple_call_set_fndecl (new_stmt, e->callee->decl);
- gimple_call_set_fntype (new_stmt, gimple_call_fntype (e->call_stmt));
+ cgraph_node *origin = e->callee;
+ while (origin->clone_of)
+ origin = origin->clone_of;
+
+ if ((origin->former_clone_of
+ && old_fntype == TREE_TYPE (origin->former_clone_of))
+ || old_fntype == TREE_TYPE (origin->decl))
+ gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl));
+ else
+ {
+ bitmap skip = e->callee->clone.combined_args_to_skip;
+ tree t = cgraph_build_function_type_skip_args (old_fntype, skip,
+ false);
+ gimple_call_set_fntype (new_stmt, t);
+ }
if (gimple_vdef (new_stmt)
&& TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)