aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2010-12-15 14:19:46 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2010-12-15 14:19:46 +0100
commitceeffab0ba9cd6133a07c97df3c374d7b39dadee (patch)
tree526589a7e9753bc7a413ea63388bd8d0aa594f12 /gcc/cgraphunit.c
parent9d0dcda15ccb43b5b24b370e793142736d5742d3 (diff)
downloadgcc-ceeffab0ba9cd6133a07c97df3c374d7b39dadee.zip
gcc-ceeffab0ba9cd6133a07c97df3c374d7b39dadee.tar.gz
gcc-ceeffab0ba9cd6133a07c97df3c374d7b39dadee.tar.bz2
re PR tree-optimization/46053 (g++.dg/torture/pr45699.C FAILs with -fno-early-inlining)
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. From-SVN: r167855
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 04a69f3..013cf63 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