Commit 61dd6a2e by Jan Hubicka Committed by Jan Hubicka

devirt-13.C: Update template.

	* g++.dg/ipa/devirt-13.C: Update template.
	* ipa-utils.h (possible_polymorphic_call_targets): Determine context of
	the call.
	* gimple-fold.c (gimple_fold_call): Use ipa-devirt to devirtualize.

From-SVN: r206042
parent 2477c234
2013-12-17 Jan Hubicka <hubicka@ucw.cz>
* ipa-utils.h (possible_polymorphic_call_targets): Determine context of
the call.
* gimple-fold.c (gimple_fold_call): Use ipa-devirt to devirtualize.
2013-12-17 Jakub Jelinek <jakub@redhat.com> 2013-12-17 Jakub Jelinek <jakub@redhat.com>
* expr.c (convert_modes): For SUBREG_PROMOTED_VAR_P use SUBREG_REG (x) * expr.c (convert_modes): For SUBREG_PROMOTED_VAR_P use SUBREG_REG (x)
...@@ -1153,26 +1153,20 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) ...@@ -1153,26 +1153,20 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
gimple_call_set_fn (stmt, OBJ_TYPE_REF_EXPR (callee)); gimple_call_set_fn (stmt, OBJ_TYPE_REF_EXPR (callee));
changed = true; changed = true;
} }
else if (virtual_method_call_p (callee)) else if (flag_devirtualize && virtual_method_call_p (callee))
{ {
tree obj = OBJ_TYPE_REF_OBJECT (callee); bool final;
tree binfo = gimple_extract_devirt_binfo_from_cst vec <cgraph_node *>targets
(obj, obj_type_ref_class (callee)); = possible_polymorphic_call_targets (callee, &final);
if (binfo) if (final && targets.length () <= 1)
{ {
HOST_WIDE_INT token tree fndecl;
= TREE_INT_CST_LOW (OBJ_TYPE_REF_TOKEN (callee)); if (targets.length () == 1)
tree fndecl = gimple_get_virt_method_for_binfo (token, binfo); fndecl = targets[0]->decl;
if (fndecl) else
{ fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
#ifdef ENABLE_CHECKING gimple_call_set_fndecl (stmt, fndecl);
gcc_assert (possible_polymorphic_call_target_p changed = true;
(callee, cgraph_get_node (fndecl)));
#endif
gimple_call_set_fndecl (stmt, fndecl);
changed = true;
}
} }
} }
} }
......
...@@ -121,10 +121,17 @@ possible_polymorphic_call_targets (tree call, ...@@ -121,10 +121,17 @@ possible_polymorphic_call_targets (tree call,
bool *final = NULL, bool *final = NULL,
void **cache_token = NULL) void **cache_token = NULL)
{ {
tree otr_type;
HOST_WIDE_INT otr_token;
ipa_polymorphic_call_context context;
get_polymorphic_call_info (current_function_decl,
call,
&otr_type, &otr_token, &context);
return possible_polymorphic_call_targets (obj_type_ref_class (call), return possible_polymorphic_call_targets (obj_type_ref_class (call),
tree_to_uhwi tree_to_uhwi
(OBJ_TYPE_REF_TOKEN (call)), (OBJ_TYPE_REF_TOKEN (call)),
ipa_dummy_polymorphic_call_context, context,
final, cache_token); final, cache_token);
} }
......
2013-12-17 Jan Hubicka <hubicka@ucw.cz>
* g++.dg/ipa/devirt-13.C: Update template.
2013-12-16 Janus Weil <janus@gcc.gnu.org> 2013-12-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/54949 PR fortran/54949
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment