summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-15 13:19:46 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-15 13:19:46 +0000
commit3fd0ca33a322350118d6b06379b3eb24791dbfd2 (patch)
tree526589a7e9753bc7a413ea63388bd8d0aa594f12 /gcc/cgraphunit.c
parenta6e634c689c9cceec17519cdb7289a0a526860af (diff)
downloadgcc-3fd0ca33a322350118d6b06379b3eb24791dbfd2.tar.gz
2010-12-15 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/46053 PR middle-end/46287 PR middle-end/46242 * cgraph.h (cgraph_indirect_call_info): New field thunk_delta. * gimple.h (gimple_fold_obj_type_ref): Declaration removed. (gimple_fold_call): Declare. (gimple_adjust_this_by_delta): Likewise. * cgraph.c (cgraph_make_edge_direct): New parameter delta. Updated all users. (cgraph_clone_edge): Create a copy of indirect_info also for direct edges. * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Adjust this parameters. * gimple-fold.c (gimple_fold_obj_type_ref_known_binfo): Renamed to gimple_get_virt_mehtod_for_binfo, new parameter delta. Do not search through thunks, in fact bail out if we encounter one, check that BINFO_VIRTUALS is not NULL. (gimple_adjust_this_by_delta): New function. (gimple_fold_obj_type_ref): Removed. (gimple_fold_obj_type_ref_call): New function. (fold_gimple_call): Renamed to gimple_fold_call, made external. Updated users. Call gimple_fold_obj_type_ref_call instead of gimple_fold_obj_type_ref. * ipa-cp.c (ipcp_process_devirtualization_opportunities): Process thunk deltas. (ipcp_discover_new_direct_edges): Likewise. * ipa-prop.c (ipa_make_edge_direct_to_target): New parameter delta. Updated callers. (ipa_write_indirect_edge_info): Stream thunk_delta. (ipa_read_indirect_edge_info): Likewise. * tree-ssa-ccp.c (ccp_fold_stmt): Use gimple_fold_call instead of gimple_fold_obj_type_ref. * testsuite/g++.dg/ipa/pr46053.C: New test. * testsuite/g++.dg/ipa/pr46287-1.C: Likewise. * testsuite/g++.dg/ipa/pr46287-2.C: Likewise. * testsuite/g++.dg/ipa/pr46287-3.C: Likewise. * testsuite/g++.dg/torture/covariant-1.C: Likewise. * testsuite/g++.dg/torture/pr46287.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167855 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 04a69f34d24..013cf638f71 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2134,6 +2134,8 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
{
tree decl = gimple_call_fndecl (e->call_stmt);
gimple new_stmt;
+ gimple_stmt_iterator gsi;
+ bool gsi_computed = false;
#ifdef ENABLE_CHECKING
struct cgraph_node *node;
#endif
@@ -2166,9 +2168,26 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
}
}
+ if (e->indirect_info && e->indirect_info->thunk_delta
+ && integer_nonzerop (e->indirect_info->thunk_delta)
+ && (!e->callee->clone.combined_args_to_skip
+ || !bitmap_bit_p (e->callee->clone.combined_args_to_skip, 0)))
+ {
+ if (cgraph_dump_file)
+ {
+ fprintf (cgraph_dump_file, " Thunk delta is ");
+ print_generic_expr (cgraph_dump_file,
+ e->indirect_info->thunk_delta, 0);
+ fprintf (cgraph_dump_file, "\n");
+ }
+ gsi = gsi_for_stmt (e->call_stmt);
+ gsi_computed = true;
+ gimple_adjust_this_by_delta (&gsi, e->indirect_info->thunk_delta);
+ e->indirect_info->thunk_delta = NULL_TREE;
+ }
+
if (e->callee->clone.combined_args_to_skip)
{
- gimple_stmt_iterator gsi;
int lp_nr;
new_stmt
@@ -2180,7 +2199,8 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
&& TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)
SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
- gsi = gsi_for_stmt (e->call_stmt);
+ if (!gsi_computed)
+ gsi = gsi_for_stmt (e->call_stmt);
gsi_replace (&gsi, new_stmt, false);
/* We need to defer cleaning EH info on the new statement to
fixup-cfg. We may not have dominator information at this point