diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-26 19:54:44 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-26 19:54:44 +0000 |
commit | e806c56f7d0d5d17b7fcd043ab8755952fb68fd1 (patch) | |
tree | ff4f08f1aba0f9a9dd96795eaa4ede3df6b92be8 /gcc/ipa-inline-analysis.c | |
parent | 4102f6177fa94f8782745e4e4363f171517ea399 (diff) | |
download | gcc-e806c56f7d0d5d17b7fcd043ab8755952fb68fd1.tar.gz |
* ipa-inline-analysis.c (redirect_to_unreachable): New function.
(edge_set_predicate): Use it to mark unreachable edges.
(inline_summary_t::duplicate): Remove unnecesary code.
(remap_edge_summaries): Likewise.
(dump_inline_summary): Report contains_cilk_spawn.
(compute_inline_parameters): Compute contains_cilk_spawn.
(inline_read_section, inline_write_summary): Stream
contains_cilk_spawn.
* ipa-inline.c (can_inline_edge_p): Do not tuch
DECL_STRUCT_FUNCTION that may not be available;
use CIF_CILK_SPAWN for cilk; fix optimization attribute checks;
remove check for callee_fun->can_throw_non_call_exceptions and
replace it by optimization attribute check; check for flag_exceptions.
* ipa-inline-transform.c (inline_call): Maintain
DECL_FUNCTION_PERSONALITY
* ipa-inline.h (inline_summary): Add contains_cilk_spawn.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221706 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline-analysis.c')
-rw-r--r-- | gcc/ipa-inline-analysis.c | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 5707f6c9603..6f34c47449b 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -760,6 +760,31 @@ account_size_time (struct inline_summary *summary, int size, int time, } } +/* We proved E to be unreachable, redirect it to __bultin_unreachable. */ + +static void +redirect_to_unreachable (struct cgraph_edge *e) +{ + struct cgraph_node *callee = !e->inline_failed ? e->callee : NULL; + struct inline_edge_summary *es = inline_edge_summary (e); + + if (e->speculative) + e->resolve_speculation (builtin_decl_implicit (BUILT_IN_UNREACHABLE)); + if (!e->callee) + e->make_direct (cgraph_node::get_create + (builtin_decl_implicit (BUILT_IN_UNREACHABLE))); + else + e->redirect_callee (cgraph_node::get_create + (builtin_decl_implicit (BUILT_IN_UNREACHABLE))); + e->inline_failed = CIF_UNREACHABLE; + e->frequency = 0; + e->count = 0; + es->call_stmt_size = 0; + es->call_stmt_time = 0; + if (callee) + callee->remove_symbol_and_inline_clones (); +} + /* Set predicate for edge E. */ static void @@ -769,18 +794,8 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate) /* If the edge is determined to be never executed, redirect it to BUILTIN_UNREACHABLE to save inliner from inlining into it. */ - if (predicate && false_predicate_p (predicate) && e->callee) - { - struct cgraph_node *callee = !e->inline_failed ? e->callee : NULL; - - e->redirect_callee (cgraph_node::get_create - (builtin_decl_implicit (BUILT_IN_UNREACHABLE))); - e->inline_failed = CIF_UNREACHABLE; - es->call_stmt_size = 0; - es->call_stmt_time = 0; - if (callee) - callee->remove_symbol_and_inline_clones (); - } + if (predicate && false_predicate_p (predicate)) + redirect_to_unreachable (e); if (predicate && !true_predicate_p (predicate)) { if (!es->predicate) @@ -1228,10 +1243,7 @@ inline_summary_t::duplicate (cgraph_node *src, info); if (false_predicate_p (&new_predicate) && !false_predicate_p (es->predicate)) - { - optimized_out_size += es->call_stmt_size * INLINE_SIZE_SCALE; - edge->frequency = 0; - } + optimized_out_size += es->call_stmt_size * INLINE_SIZE_SCALE; edge_set_predicate (edge, &new_predicate); } @@ -1250,10 +1262,7 @@ inline_summary_t::duplicate (cgraph_node *src, info); if (false_predicate_p (&new_predicate) && !false_predicate_p (es->predicate)) - { - optimized_out_size += es->call_stmt_size * INLINE_SIZE_SCALE; - edge->frequency = 0; - } + optimized_out_size += es->call_stmt_size * INLINE_SIZE_SCALE; edge_set_predicate (edge, &new_predicate); } remap_hint_predicate_after_duplication (&info->loop_iterations, @@ -1441,6 +1450,8 @@ dump_inline_summary (FILE *f, struct cgraph_node *node) fprintf (f, " always_inline"); if (s->inlinable) fprintf (f, " inlinable"); + if (s->contains_cilk_spawn) + fprintf (f, " contains_cilk_spawn"); fprintf (f, "\n self time: %i\n", s->self_time); fprintf (f, " global time: %i\n", s->time); fprintf (f, " self size: %i\n", s->self_size); @@ -2925,6 +2936,8 @@ compute_inline_parameters (struct cgraph_node *node, bool early) else info->inlinable = tree_inlinable_function_p (node->decl); + info->contains_cilk_spawn = fn_contains_cilk_spawn_p (cfun); + /* Type attributes can use parameter indices to describe them. */ if (TYPE_ATTRIBUTES (TREE_TYPE (node->decl))) node->local.can_change_signature = false; @@ -3487,14 +3500,6 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, es->predicate, operand_map, offset_map, possible_truths, toplev_predicate); edge_set_predicate (e, &p); - /* TODO: We should remove the edge for code that will be - optimized out, but we need to keep verifiers and tree-inline - happy. Make it cold for now. */ - if (false_predicate_p (&p)) - { - e->count = 0; - e->frequency = 0; - } } else edge_set_predicate (e, toplev_predicate); @@ -3516,14 +3521,6 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, es->predicate, operand_map, offset_map, possible_truths, toplev_predicate); edge_set_predicate (e, &p); - /* TODO: We should remove the edge for code that will be optimized - out, but we need to keep verifiers and tree-inline happy. - Make it cold for now. */ - if (false_predicate_p (&p)) - { - e->count = 0; - e->frequency = 0; - } } else edge_set_predicate (e, toplev_predicate); @@ -4228,6 +4225,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, bp = streamer_read_bitpack (&ib); info->inlinable = bp_unpack_value (&bp, 1); + info->contains_cilk_spawn = bp_unpack_value (&bp, 1); count2 = streamer_read_uhwi (&ib); gcc_assert (!info->conds); @@ -4393,6 +4391,7 @@ inline_write_summary (void) streamer_write_hwi (ob, info->self_time); bp = bitpack_create (ob->main_stream); bp_pack_value (&bp, info->inlinable, 1); + bp_pack_value (&bp, info->contains_cilk_spawn, 1); streamer_write_bitpack (&bp); streamer_write_uhwi (ob, vec_safe_length (info->conds)); for (i = 0; vec_safe_iterate (info->conds, i, &c); i++) |