diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-16 17:26:20 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-16 17:26:20 +0000 |
commit | c02e93ceebcb1aa1a073797eb4e55744be7a2c16 (patch) | |
tree | fdf0ac7629ddac3966a0a7ce9814ca63b3387581 /gcc | |
parent | b49f1fbb79e540b892774b94d442603bc891a7a4 (diff) | |
download | gcc-c02e93ceebcb1aa1a073797eb4e55744be7a2c16.tar.gz |
* ipa-cp.c (ipa_get_indirect_edge_target_1): Use can_refer; do not
speculate to impossible targets.
* ipa-prop.c (try_make_edge_direct_virtual_call): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231705 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ipa-cp.c | 23 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 12 |
3 files changed, 31 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee2af1db9fb..323c8d19b2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-12-10 Jan Hubicka <hubicka@ucw.cz> + + * ipa-cp.c (ipa_get_indirect_edge_target_1): Use can_refer; do not + speculate to impossible targets. + * ipa-prop.c (try_make_edge_direct_virtual_call): Likewise. + 2015-12-16 Aditya Kumar <aditya.k7@samsung.com> Sebastian Pop <s.pop@samsung.com> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 8087f661d3e..782df710e46 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2077,15 +2077,22 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie, unsigned HOST_WIDE_INT offset; if (vtable_pointer_value_to_vtable (t, &vtable, &offset)) { + bool can_refer; target = gimple_get_virt_method_for_vtable (ie->indirect_info->otr_token, - vtable, offset); - if (target) + vtable, offset, &can_refer); + if (can_refer) { - if ((TREE_CODE (TREE_TYPE (target)) == FUNCTION_TYPE - && DECL_FUNCTION_CODE (target) == BUILT_IN_UNREACHABLE) + if (!target + || (TREE_CODE (TREE_TYPE (target)) == FUNCTION_TYPE + && DECL_FUNCTION_CODE (target) == BUILT_IN_UNREACHABLE) || !possible_polymorphic_call_target_p (ie, cgraph_node::get (target))) - target = ipa_impossible_devirt_target (ie, target); + { + /* Do not speculate builtin_unreachable, it is stupid! */ + if (ie->indirect_info->vptr_changed) + return NULL; + target = ipa_impossible_devirt_target (ie, target); + } *speculative = ie->indirect_info->vptr_changed; if (!*speculative) return target; @@ -2163,7 +2170,11 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie, if (target && !possible_polymorphic_call_target_p (ie, cgraph_node::get (target))) - target = ipa_impossible_devirt_target (ie, target); + { + if (*speculative) + return NULL; + target = ipa_impossible_devirt_target (ie, target); + } return target; } diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 72c2fed63ff..0ab24274004 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -2898,18 +2898,22 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie, true); if (t && vtable_pointer_value_to_vtable (t, &vtable, &offset)) { + bool can_refer; t = gimple_get_virt_method_for_vtable (ie->indirect_info->otr_token, - vtable, offset); - if (t) + vtable, offset, &can_refer); + if (can_refer) { - if ((TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE - && DECL_FUNCTION_CODE (t) == BUILT_IN_UNREACHABLE) + if (!t + || (TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE + && DECL_FUNCTION_CODE (t) == BUILT_IN_UNREACHABLE) || !possible_polymorphic_call_target_p (ie, cgraph_node::get (t))) { /* Do not speculate builtin_unreachable, it is stupid! */ if (!ie->indirect_info->vptr_changed) target = ipa_impossible_devirt_target (ie, target); + else + target = NULL; } else { |