diff options
author | Martin Jambor <mjambor@suse.cz> | 2010-12-22 13:56:54 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2010-12-22 13:56:54 +0100 |
commit | 32aa622ca800f92d7250e1ab4be08d3e174ef953 (patch) | |
tree | a1cfc1bdd186a3e0990698cbae0cf216e7ac85d0 /gcc/ipa-prop.c | |
parent | 5eeac8330cbea6aa8d170473b7eab105734fb1d8 (diff) | |
download | gcc-32aa622ca800f92d7250e1ab4be08d3e174ef953.zip gcc-32aa622ca800f92d7250e1ab4be08d3e174ef953.tar.gz gcc-32aa622ca800f92d7250e1ab4be08d3e174ef953.tar.bz2 |
re PR tree-optimization/45934 (g++.old-deja/g++.other/dtor5.C FAILs with -finline-small-functions)
2010-12-22 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/45934
PR tree-optimization/46302
PR tree-optimization/46987
* gimple-fold.c (get_base_binfo_for_type): Removed.
(gimple_get_relevant_ref_binfo): Likewise.
(gimple_fold_obj_type_ref_call): Dumb down to 4.5 functionality,
removed parameter inplace, updated the caller.
* gimple.h (gimple_get_relevant_ref_binfo): Remove declaration.
* ipa-cp.c (ipcp_propagate_types): Do not derive types from constants.
(ipcp_discover_new_direct_edges): Do not do devirtualization based on
constants.
* ipa-prop.c (compute_known_type_jump_func): Use
get_ref_base_and_extent and get_binfo_at_offset instead of
gimple_get_relevant_ref_binfo.
(compute_known_type_jump_func): Likewise.
(update_jump_functions_after_inlining): Do not derive types from
constants.
(try_make_edge_direct_virtual_call): Likewise.
* tree.c (get_binfo_at_offset): Get type from non-artificial fields.
* testsuite/g++.dg/ipa/ipcp-ivi-1.C: Removed.
* testsuite/g++.dg/ipa/ivinline-6.C: Likewise.
* testsuite/g++.dg/otr-fold-1.C: Likewise.
* testsuite/g++.dg/otr-fold-2.C: Likewise.
* testsuite/g++.dg/tree-ssa/pr43411.C: Xfail dump scan.
* testsuite/g++.dg/tree-ssa/pr45605.C: Likewise.
* testsuite/g++.dg/tree-ssa/pr46987.C: New test.
From-SVN: r168168
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r-- | gcc/ipa-prop.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index f0a5c60..b6e3f37 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -362,7 +362,7 @@ compute_complex_assign_jump_func (struct ipa_node_params *info, gimple stmt, tree name) { HOST_WIDE_INT offset, size, max_size; - tree op1, op2, type; + tree op1, op2, base, type; int index; op1 = gimple_assign_rhs1 (stmt); @@ -404,20 +404,21 @@ compute_complex_assign_jump_func (struct ipa_node_params *info, type = TREE_TYPE (op1); if (TREE_CODE (type) != RECORD_TYPE) return; - op1 = get_ref_base_and_extent (op1, &offset, &size, &max_size); - if (TREE_CODE (op1) != MEM_REF + base = get_ref_base_and_extent (op1, &offset, &size, &max_size); + if (TREE_CODE (base) != MEM_REF /* If this is a varying address, punt. */ || max_size == -1 || max_size != size) return; - offset += mem_ref_offset (op1).low * BITS_PER_UNIT; - op1 = TREE_OPERAND (op1, 0); - if (TREE_CODE (op1) != SSA_NAME - || !SSA_NAME_IS_DEFAULT_DEF (op1) + offset += mem_ref_offset (base).low * BITS_PER_UNIT; + base = TREE_OPERAND (base, 0); + if (TREE_CODE (base) != SSA_NAME + || !SSA_NAME_IS_DEFAULT_DEF (base) || offset < 0) return; - index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1)); + /* Dynamic types are changed only in constructors and destructors and */ + index = ipa_get_param_decl_index (info, SSA_NAME_VAR (base)); if (index >= 0) { jfunc->type = IPA_JF_ANCESTOR; @@ -534,13 +535,26 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info, static void compute_known_type_jump_func (tree op, struct ipa_jump_func *jfunc) { - tree binfo; + HOST_WIDE_INT offset, size, max_size; + tree base, binfo; - if (TREE_CODE (op) != ADDR_EXPR) + if (TREE_CODE (op) != ADDR_EXPR + || TREE_CODE (TREE_TYPE (TREE_TYPE (op))) != RECORD_TYPE) return; op = TREE_OPERAND (op, 0); - binfo = gimple_get_relevant_ref_binfo (op, NULL_TREE); + base = get_ref_base_and_extent (op, &offset, &size, &max_size); + if (!DECL_P (base) + || max_size == -1 + || max_size != size + || TREE_CODE (TREE_TYPE (base)) != RECORD_TYPE + || is_global_var (base)) + return; + + binfo = TYPE_BINFO (TREE_TYPE (base)); + if (!binfo) + return; + binfo = get_binfo_at_offset (binfo, offset, TREE_TYPE (op)); if (binfo) { jfunc->type = IPA_JF_KNOWN_TYPE; @@ -1420,17 +1434,6 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs, src = ipa_get_ith_jump_func (top, dst->value.ancestor.formal_id); if (src->type == IPA_JF_KNOWN_TYPE) combine_known_type_and_ancestor_jfs (src, dst); - else if (src->type == IPA_JF_CONST) - { - struct ipa_jump_func kt_func; - - kt_func.type = IPA_JF_UNKNOWN; - compute_known_type_jump_func (src->value.constant, &kt_func); - if (kt_func.type == IPA_JF_KNOWN_TYPE) - combine_known_type_and_ancestor_jfs (&kt_func, dst); - else - dst->type = IPA_JF_UNKNOWN; - } else if (src->type == IPA_JF_PASS_THROUGH && src->value.pass_through.operation == NOP_EXPR) dst->value.ancestor.formal_id = src->value.pass_through.formal_id; @@ -1543,15 +1546,6 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie, if (jfunc->type == IPA_JF_KNOWN_TYPE) binfo = jfunc->value.base_binfo; - else if (jfunc->type == IPA_JF_CONST) - { - tree cst = jfunc->value.constant; - if (TREE_CODE (cst) == ADDR_EXPR) - binfo = gimple_get_relevant_ref_binfo (TREE_OPERAND (cst, 0), - NULL_TREE); - else - return NULL; - } else return NULL; |