Commit 48b1474e by Martin Jambor Committed by Martin Jambor

ipa-prop.c (ipa_make_edge_direct_to_target): Redirect calls to non-functions to…

ipa-prop.c (ipa_make_edge_direct_to_target): Redirect calls to non-functions to builtin_unreachable.

2013-05-15  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.c (ipa_make_edge_direct_to_target): Redirect calls to
	non-functions to builtin_unreachable.
	* ipa-inline-transform.c (inline_call): Do not assert estimates were
	correct when new direct edges were discovered.

From-SVN: r198926
parent 9de04252
2013-05-15 Martin Jambor <mjambor@suse.cz> 2013-05-15 Martin Jambor <mjambor@suse.cz>
* ipa-prop.c (ipa_make_edge_direct_to_target): Redirect calls to
non-functions to builtin_unreachable.
* ipa-inline-transform.c (inline_call): Do not assert estimates were
correct when new direct edges were discovered.
2013-05-15 Martin Jambor <mjambor@suse.cz>
* ipa-prop.c (ipa_print_node_jump_functions): Print symbol order in * ipa-prop.c (ipa_print_node_jump_functions): Print symbol order in
header, print symbol order instead of node uid, print more information header, print symbol order instead of node uid, print more information
about indirect edge targets. about indirect edge targets.
......
...@@ -260,7 +260,7 @@ inline_call (struct cgraph_edge *e, bool update_original, ...@@ -260,7 +260,7 @@ inline_call (struct cgraph_edge *e, bool update_original,
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
/* Verify that estimated growth match real growth. Allow off-by-one /* Verify that estimated growth match real growth. Allow off-by-one
error due to INLINE_SIZE_SCALE roudoff errors. */ error due to INLINE_SIZE_SCALE roudoff errors. */
gcc_assert (!update_overall_summary || !overall_size gcc_assert (!update_overall_summary || !overall_size || new_edges_found
|| abs (estimated_growth - (new_size - old_size)) <= 1 || abs (estimated_growth - (new_size - old_size)) <= 1
/* FIXME: a hack. Edges with false predicate are accounted /* FIXME: a hack. Edges with false predicate are accounted
wrong, we should remove them from callgraph. */ wrong, we should remove them from callgraph. */
......
...@@ -2200,6 +2200,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target) ...@@ -2200,6 +2200,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
{ {
struct cgraph_node *callee; struct cgraph_node *callee;
struct inline_edge_summary *es = inline_edge_summary (ie); struct inline_edge_summary *es = inline_edge_summary (ie);
bool unreachable = false;
if (TREE_CODE (target) == ADDR_EXPR) if (TREE_CODE (target) == ADDR_EXPR)
target = TREE_OPERAND (target, 0); target = TREE_OPERAND (target, 0);
...@@ -2210,12 +2211,17 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target) ...@@ -2210,12 +2211,17 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
{ {
if (dump_file) if (dump_file)
fprintf (dump_file, "ipa-prop: Discovered direct call to non-function" fprintf (dump_file, "ipa-prop: Discovered direct call to non-function"
" in %s/%i.\n", " in %s/%i, making it unreachable.\n",
cgraph_node_name (ie->caller), ie->caller->symbol.order); cgraph_node_name (ie->caller), ie->caller->symbol.order);
return NULL; target = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
callee = cgraph_get_create_node (target);
unreachable = true;
} }
else
callee = cgraph_get_node (target);
} }
callee = cgraph_get_node (target); else
callee = cgraph_get_node (target);
/* Because may-edges are not explicitely represented and vtable may be external, /* Because may-edges are not explicitely represented and vtable may be external,
we may create the first reference to the object in the unit. */ we may create the first reference to the object in the unit. */
...@@ -2252,7 +2258,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target) ...@@ -2252,7 +2258,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
- eni_size_weights.call_cost); - eni_size_weights.call_cost);
es->call_stmt_time -= (eni_time_weights.indirect_call_cost es->call_stmt_time -= (eni_time_weights.indirect_call_cost
- eni_time_weights.call_cost); - eni_time_weights.call_cost);
if (dump_file) if (dump_file && !unreachable)
{ {
fprintf (dump_file, "ipa-prop: Discovered %s call to a known target " fprintf (dump_file, "ipa-prop: Discovered %s call to a known target "
"(%s/%i -> %s/%i), for stmt ", "(%s/%i -> %s/%i), for stmt ",
......
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