diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-15 13:19:46 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-15 13:19:46 +0000 |
commit | 3fd0ca33a322350118d6b06379b3eb24791dbfd2 (patch) | |
tree | 526589a7e9753bc7a413ea63388bd8d0aa594f12 /gcc/ipa-cp.c | |
parent | a6e634c689c9cceec17519cdb7289a0a526860af (diff) | |
download | gcc-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/ipa-cp.c')
-rw-r--r-- | gcc/ipa-cp.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 33ed496a2f0..24ccb920118 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1214,7 +1214,7 @@ ipcp_process_devirtualization_opportunities (struct cgraph_node *node) { int param_index, types_count, j; HOST_WIDE_INT token; - tree target; + tree target, delta; next_ie = ie->next_callee; if (!ie->indirect_info->polymorphic) @@ -1231,7 +1231,8 @@ ipcp_process_devirtualization_opportunities (struct cgraph_node *node) for (j = 0; j < types_count; j++) { tree binfo = VEC_index (tree, info->params[param_index].types, j); - tree t = gimple_fold_obj_type_ref_known_binfo (token, binfo); + tree d; + tree t = gimple_get_virt_mehtod_for_binfo (token, binfo, &d, true); if (!t) { @@ -1239,8 +1240,11 @@ ipcp_process_devirtualization_opportunities (struct cgraph_node *node) break; } else if (!target) - target = t; - else if (target != t) + { + target = t; + delta = d; + } + else if (target != t || !tree_int_cst_equal (delta, d)) { target = NULL_TREE; break; @@ -1248,7 +1252,7 @@ ipcp_process_devirtualization_opportunities (struct cgraph_node *node) } if (target) - ipa_make_edge_direct_to_target (ie, target); + ipa_make_edge_direct_to_target (ie, target, delta); } } @@ -1288,6 +1292,7 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node, int index, tree cst) for (ie = node->indirect_calls; ie; ie = next_ie) { struct cgraph_indirect_call_info *ici = ie->indirect_info; + tree target, delta = NULL_TREE; next_ie = ie->next_callee; if (ici->param_index != index) @@ -1307,12 +1312,15 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node, int index, tree cst) continue; gcc_assert (ie->indirect_info->anc_offset == 0); token = ie->indirect_info->otr_token; - cst = gimple_fold_obj_type_ref_known_binfo (token, binfo); - if (!cst) + target = gimple_get_virt_mehtod_for_binfo (token, binfo, &delta, + true); + if (!target) continue; } + else + target = cst; - ipa_make_edge_direct_to_target (ie, cst); + ipa_make_edge_direct_to_target (ie, target, delta); } } |