ipa-cp.c (ipa_get_indirect_edge_target_1): Use can_refer; do not speculate to impossible targets.
* 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. From-SVN: r231705
This commit is contained in:
parent
8062bca66d
commit
2994ab20f1
@ -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>
|
||||
|
||||
|
17
gcc/ipa-cp.c
17
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
|
||||
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)))
|
||||
{
|
||||
/* 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)))
|
||||
{
|
||||
if (*speculative)
|
||||
return NULL;
|
||||
target = ipa_impossible_devirt_target (ie, target);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
@ -2898,11 +2898,13 @@ 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
|
||||
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)))
|
||||
@ -2910,6 +2912,8 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie,
|
||||
/* 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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user