diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-02-19 08:42:06 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-02-19 07:42:06 +0000 |
commit | 0a2550e70599aaf958afc51529cb481327ad6f75 (patch) | |
tree | 76c4ca121f72263949b151997bf74f096da8e207 /gcc | |
parent | 2dbe8b7088abd37757aaa91d3cdacd3630b4438f (diff) | |
download | gcc-0a2550e70599aaf958afc51529cb481327ad6f75.zip gcc-0a2550e70599aaf958afc51529cb481327ad6f75.tar.gz gcc-0a2550e70599aaf958afc51529cb481327ad6f75.tar.bz2 |
ipa-prop.h (ipa_ancestor_jf_data): Update ocmment.
* ipa-prop.h (ipa_ancestor_jf_data): Update ocmment.
* ipa-prop.c (ipa_set_jf_known_type): Return early when
not devirtualizing.
(ipa_set_ancestor_jf): Set type to NULL hwen it is not preserved;
do more sanity checks.
(detect_type_change): Return true when giving up early.
(compute_complex_assign_jump_func): Fix type parameter of
ipa_set_ancestor_jf.
(compute_complex_ancestor_jump_func): Likewise.
(update_jump_functions_after_inlining): Fix updating of
ancestor function.
* ipa-cp.c (ipa_get_jf_ancestor_result): Be ready for type
to be NULL.
From-SVN: r207877
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/ipa-cp.c | 4 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 20 | ||||
-rw-r--r-- | gcc/ipa-prop.h | 4 |
4 files changed, 37 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 315691a..c4ea4d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,21 @@ 2014-02-18 Jan Hubicka <hubicka@ucw.cz> + * ipa-prop.h (ipa_ancestor_jf_data): Update ocmment. + * ipa-prop.c (ipa_set_jf_known_type): Return early when + not devirtualizing. + (ipa_set_ancestor_jf): Set type to NULL hwen it is not preserved; + do more sanity checks. + (detect_type_change): Return true when giving up early. + (compute_complex_assign_jump_func): Fix type parameter of + ipa_set_ancestor_jf. + (compute_complex_ancestor_jump_func): Likewise. + (update_jump_functions_after_inlining): Fix updating of + ancestor function. + * ipa-cp.c (ipa_get_jf_ancestor_result): Be ready for type + to be NULL. + +2014-02-18 Jan Hubicka <hubicka@ucw.cz> + * cgraph.c (cgraph_update_edges_for_call_stmt_node): Also remove inline clones when edge disappears. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index d93b45c..f7cf716 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -798,7 +798,9 @@ ipa_get_jf_ancestor_result (struct ipa_jump_func *jfunc, tree input) tree t = TREE_OPERAND (input, 0); t = build_ref_for_offset (EXPR_LOCATION (t), t, ipa_get_jf_ancestor_offset (jfunc), - ipa_get_jf_ancestor_type (jfunc), NULL, false); + ipa_get_jf_ancestor_type (jfunc) + ? ipa_get_jf_ancestor_type (jfunc) + : ptr_type_node, NULL, false); return build_fold_addr_expr (t); } else diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 0f29399..133bfc0 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -393,6 +393,9 @@ ipa_set_jf_known_type (struct ipa_jump_func *jfunc, HOST_WIDE_INT offset, { gcc_assert (TREE_CODE (component_type) == RECORD_TYPE && TYPE_BINFO (component_type)); + if (!flag_devirtualize) + return; + gcc_assert (BINFO_VTABLE (TYPE_BINFO (component_type))); jfunc->type = IPA_JF_KNOWN_TYPE; jfunc->value.known_type.offset = offset, jfunc->value.known_type.base_type = base_type; @@ -477,10 +480,16 @@ ipa_set_ancestor_jf (struct ipa_jump_func *jfunc, HOST_WIDE_INT offset, tree type, int formal_id, bool agg_preserved, bool type_preserved) { + if (!flag_devirtualize) + type_preserved = false; + gcc_assert (!type_preserved + || (TREE_CODE (type) == RECORD_TYPE + && TYPE_BINFO (type) + && BINFO_VTABLE (TYPE_BINFO (type)))); jfunc->type = IPA_JF_ANCESTOR; jfunc->value.ancestor.formal_id = formal_id; jfunc->value.ancestor.offset = offset; - jfunc->value.ancestor.type = type; + jfunc->value.ancestor.type = type_preserved ? type : NULL; jfunc->value.ancestor.agg_preserved = agg_preserved; jfunc->value.ancestor.type_preserved = type_preserved; } @@ -686,7 +695,7 @@ detect_type_change (tree arg, tree base, tree comp_type, gimple call, || TREE_CODE (comp_type) != RECORD_TYPE || !TYPE_BINFO (comp_type) || !BINFO_VTABLE (TYPE_BINFO (comp_type))) - return false; + return true; /* C++ methods are not allowed to change THIS pointer unless they are constructors or destructors. */ @@ -1103,7 +1112,8 @@ compute_complex_assign_jump_func (struct ipa_node_params *info, bool type_p = !detect_type_change (op1, base, TREE_TYPE (param_type), call, jfunc, offset); if (type_p || jfunc->type == IPA_JF_UNKNOWN) - ipa_set_ancestor_jf (jfunc, offset, TREE_TYPE (op1), index, + ipa_set_ancestor_jf (jfunc, offset, + type_p ? TREE_TYPE (param_type) : NULL, index, parm_ref_data_pass_through_p (&parms_ainfo[index], call, ssa), type_p); } @@ -1236,7 +1246,7 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info, type_p = !detect_type_change (obj, expr, TREE_TYPE (param_type), call, jfunc, offset); if (type_p || jfunc->type == IPA_JF_UNKNOWN) - ipa_set_ancestor_jf (jfunc, offset, TREE_TYPE (obj), index, + ipa_set_ancestor_jf (jfunc, offset, type_p ? TREE_TYPE (param_type) : NULL, index, parm_ref_data_pass_through_p (&parms_ainfo[index], call, parm), type_p); } @@ -2391,7 +2401,7 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs, ipa_set_jf_known_type (dst, ipa_get_jf_known_type_offset (src), ipa_get_jf_known_type_base_type (src), - ipa_get_jf_known_type_base_type (src)); + ipa_get_jf_known_type_component_type (src)); else dst->type = IPA_JF_UNKNOWN; break; diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 299627b..8fdd92c 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -130,7 +130,9 @@ struct GTY(()) ipa_ancestor_jf_data { /* Offset of the field representing the ancestor. */ HOST_WIDE_INT offset; - /* Type of the result. */ + /* Type of the result. + When TYPE_PRESERVED is false, TYPE is NULL, since it is only + relevant for the devirtualization machinery. */ tree type; /* Number of the caller's formal parameter being passed. */ int formal_id; |