From 89faf322d87cbfad71c079acc8b96a5a145a60f7 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Mon, 5 Dec 2011 08:51:53 +0000 Subject: [PATCH] cgraph.c (cgraph_create_edge_1): Initialize call_stmt_cannot_inline_p from the stmt if possible. 2011-12-05 Richard Guenther * cgraph.c (cgraph_create_edge_1): Initialize call_stmt_cannot_inline_p from the stmt if possible. (cgraph_make_edge_direct): Likewise. * gimple-streamer-in.c (input_gimple_stmt): Do not call gimple_call_set_cannot_inline. * gimple.h (enum gf_mask): Remove GF_CALL_CANNOT_INLINE, shift values. (gimple_call_set_cannot_inline): Remove. (gimple_call_cannot_inline_p): Likewise. * ipa-inline-analysis.c (initialize_inline_failed): Look at the edge call_stmt_cannot_inline_p flag. * ipa-inline.c (can_inline_edge_p): Likewise. (early_inliner): Only update the edge flag. * ipa-prop.c (update_indirect_edges_after_inlining): Likewise. (ipa_modify_call_arguments): Do not call gimple_call_set_cannot_inline. * cgraphunit.c (assemble_thunk): Likewise. * gimple-fold.c (gimple_fold_call): Likewise. * tree.h (CALL_CANNOT_INLINE_P): Remove. * tree-mudflap.c (mf_xform_statements): Do not modify alloca calls. * builtins.c (expand_builtin_alloca): With -fmudflap do not expand alloca calls inline. * cfgexpand.c (expand_call_stmt): Do not set CALL_CANNOT_INLINE_P. * gimple.c (gimple_build_call_from_tree): Do not read CALL_CANNOT_INLINE_P. * gimplify.c (gimplify_call_expr): Do not copy CALL_CANNOT_INLINE_P. From-SVN: r182001 --- gcc/ChangeLog | 29 +++++++++++++++++++++++++++++ gcc/builtins.c | 4 ++-- gcc/cfgexpand.c | 1 - gcc/cgraph.c | 17 +++++++++-------- gcc/cgraphunit.c | 1 - gcc/gimple-fold.c | 13 +------------ gcc/gimple-streamer-in.c | 7 ------- gcc/gimple.c | 1 - gcc/gimple.h | 38 +++++++------------------------------- gcc/gimplify.c | 1 - gcc/ipa-inline-analysis.c | 2 +- gcc/ipa-inline.c | 16 +++++----------- gcc/ipa-prop.c | 14 ++++---------- gcc/tree-mudflap.c | 11 ----------- gcc/tree.h | 6 ------ 15 files changed, 58 insertions(+), 103 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 296838111f81..ee84c7e7ae4f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,32 @@ +2011-12-05 Richard Guenther + + * cgraph.c (cgraph_create_edge_1): Initialize + call_stmt_cannot_inline_p from the stmt if possible. + (cgraph_make_edge_direct): Likewise. + * gimple-streamer-in.c (input_gimple_stmt): Do not + call gimple_call_set_cannot_inline. + * gimple.h (enum gf_mask): Remove GF_CALL_CANNOT_INLINE, shift + values. + (gimple_call_set_cannot_inline): Remove. + (gimple_call_cannot_inline_p): Likewise. + * ipa-inline-analysis.c (initialize_inline_failed): Look + at the edge call_stmt_cannot_inline_p flag. + * ipa-inline.c (can_inline_edge_p): Likewise. + (early_inliner): Only update the edge flag. + * ipa-prop.c (update_indirect_edges_after_inlining): Likewise. + (ipa_modify_call_arguments): Do not call gimple_call_set_cannot_inline. + * cgraphunit.c (assemble_thunk): Likewise. + * gimple-fold.c (gimple_fold_call): Likewise. + + * tree.h (CALL_CANNOT_INLINE_P): Remove. + * tree-mudflap.c (mf_xform_statements): Do not modify alloca calls. + * builtins.c (expand_builtin_alloca): With -fmudflap do not expand + alloca calls inline. + * cfgexpand.c (expand_call_stmt): Do not set CALL_CANNOT_INLINE_P. + * gimple.c (gimple_build_call_from_tree): Do not read + CALL_CANNOT_INLINE_P. + * gimplify.c (gimplify_call_expr): Do not copy CALL_CANNOT_INLINE_P. + 2011-12-05 Jakub Jelinek Eric Botcazou diff --git a/gcc/builtins.c b/gcc/builtins.c index 5ad69ceca92e..019da159dd4b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -4523,8 +4523,8 @@ expand_builtin_alloca (tree exp, bool cannot_accumulate) bool alloca_with_align = (DECL_FUNCTION_CODE (get_callee_fndecl (exp)) == BUILT_IN_ALLOCA_WITH_ALIGN); - /* Emit normal call if marked not-inlineable. */ - if (CALL_CANNOT_INLINE_P (exp)) + /* Emit normal call if we use mudflap. */ + if (flag_mudflap) return NULL_RTX; valid_arglist diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 15e8231ca722..868472173222 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2050,7 +2050,6 @@ expand_call_stmt (gimple stmt) CALL_ALLOCA_FOR_VAR_P (exp) = gimple_call_alloca_for_var_p (stmt); else CALL_FROM_THUNK_P (exp) = gimple_call_from_thunk_p (stmt); - CALL_CANNOT_INLINE_P (exp) = gimple_call_cannot_inline_p (stmt); CALL_EXPR_VA_ARG_PACK (exp) = gimple_call_va_arg_pack_p (stmt); SET_EXPR_LOCATION (exp, gimple_location (stmt)); TREE_BLOCK (exp) = gimple_block (stmt); diff --git a/gcc/cgraph.c b/gcc/cgraph.c index ac516abefba9..e65ddef8aec7 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -988,8 +988,12 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee, edge->can_throw_external = call_stmt ? stmt_can_throw_external (call_stmt) : false; pop_cfun (); - edge->call_stmt_cannot_inline_p = - (call_stmt ? gimple_call_cannot_inline_p (call_stmt) : false); + if (call_stmt + && callee && callee->decl + && !gimple_check_call_matching_types (call_stmt, callee->decl)) + edge->call_stmt_cannot_inline_p = true; + else + edge->call_stmt_cannot_inline_p = false; if (call_stmt && caller->call_site_hash) cgraph_add_edge_to_call_site_hash (edge); @@ -1184,12 +1188,9 @@ cgraph_make_edge_direct (struct cgraph_edge *edge, struct cgraph_node *callee) /* Insert to callers list of the new callee. */ cgraph_set_edge_callee (edge, callee); - if (edge->call_stmt - && !gimple_check_call_matching_types (edge->call_stmt, callee->decl)) - { - gimple_call_set_cannot_inline (edge->call_stmt, true); - edge->call_stmt_cannot_inline_p = true; - } + if (edge->call_stmt) + edge->call_stmt_cannot_inline_p + = !gimple_check_call_matching_types (edge->call_stmt, callee->decl); /* We need to re-determine the inlining status of the edge. */ initialize_inline_failed (edge); diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 251b55547259..886a2def0e56 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1694,7 +1694,6 @@ assemble_thunk (struct cgraph_node *node) VEC_quick_push (tree, vargs, arg); call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs); VEC_free (tree, heap, vargs); - gimple_call_set_cannot_inline (call, true); gimple_call_set_from_thunk (call, true); if (restmp) gimple_call_set_lhs (call, restmp); diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 0da5eef18a2d..3297f11364b9 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1108,23 +1108,12 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) } } - /* Check whether propagating into the function address made the - call direct, and thus possibly non-inlineable. - ??? This asks for a more conservative setting of the non-inlinable - flag, namely true for all indirect calls. But that would require - that we can re-compute the flag conservatively, thus it isn't - ever initialized from something else than return/argument type - checks . */ - callee = gimple_call_fndecl (stmt); - if (callee - && !gimple_check_call_matching_types (stmt, callee)) - gimple_call_set_cannot_inline (stmt, true); - if (inplace) return changed; /* Check for builtins that CCP can handle using information not available in the generic fold routines. */ + callee = gimple_call_fndecl (stmt); if (callee && DECL_BUILT_IN (callee)) { tree result = gimple_fold_builtin (stmt); diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c index 1facb3296f6e..dc112d0dd934 100644 --- a/gcc/gimple-streamer-in.c +++ b/gcc/gimple-streamer-in.c @@ -219,18 +219,11 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, } if (is_gimple_call (stmt)) { - tree fndecl; if (gimple_call_internal_p (stmt)) gimple_call_set_internal_fn (stmt, streamer_read_enum (ib, internal_fn, IFN_LAST)); else gimple_call_set_fntype (stmt, stream_read_tree (ib, data_in)); - /* Update the non-inlinable flag conservatively. */ - fndecl = gimple_call_fndecl (stmt); - if (fndecl - && !gimple_call_cannot_inline_p (stmt) - && !gimple_check_call_matching_types (stmt, fndecl)) - gimple_call_set_cannot_inline (stmt, true); } break; diff --git a/gcc/gimple.c b/gcc/gimple.c index 071c6515b4ca..c72b39a0d645 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -370,7 +370,6 @@ gimple_build_call_from_tree (tree t) /* Carry all the CALL_EXPR flags to the new GIMPLE_CALL. */ gimple_call_set_chain (call, CALL_EXPR_STATIC_CHAIN (t)); gimple_call_set_tail (call, CALL_EXPR_TAILCALL (t)); - gimple_call_set_cannot_inline (call, CALL_CANNOT_INLINE_P (t)); gimple_call_set_return_slot_opt (call, CALL_EXPR_RETURN_SLOT_OPT (t)); if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL diff --git a/gcc/gimple.h b/gcc/gimple.h index 8536c70e87e2..ec4e76e13ddf 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -97,14 +97,13 @@ enum gimple_rhs_class enum gf_mask { GF_ASM_INPUT = 1 << 0, GF_ASM_VOLATILE = 1 << 1, - GF_CALL_CANNOT_INLINE = 1 << 0, - GF_CALL_FROM_THUNK = 1 << 1, - GF_CALL_RETURN_SLOT_OPT = 1 << 2, - GF_CALL_TAILCALL = 1 << 3, - GF_CALL_VA_ARG_PACK = 1 << 4, - GF_CALL_NOTHROW = 1 << 5, - GF_CALL_ALLOCA_FOR_VAR = 1 << 6, - GF_CALL_INTERNAL = 1 << 7, + GF_CALL_FROM_THUNK = 1 << 0, + GF_CALL_RETURN_SLOT_OPT = 1 << 1, + GF_CALL_TAILCALL = 1 << 2, + GF_CALL_VA_ARG_PACK = 1 << 3, + GF_CALL_NOTHROW = 1 << 4, + GF_CALL_ALLOCA_FOR_VAR = 1 << 5, + GF_CALL_INTERNAL = 1 << 6, GF_OMP_PARALLEL_COMBINED = 1 << 0, /* True on an GIMPLE_OMP_RETURN statement if the return does not require @@ -2343,29 +2342,6 @@ gimple_call_tail_p (gimple s) } -/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */ - -static inline void -gimple_call_set_cannot_inline (gimple s, bool inlinable_p) -{ - GIMPLE_CHECK (s, GIMPLE_CALL); - if (inlinable_p) - s->gsbase.subcode |= GF_CALL_CANNOT_INLINE; - else - s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE; -} - - -/* Return true if GIMPLE_CALL S cannot be inlined. */ - -static inline bool -gimple_call_cannot_inline_p (gimple s) -{ - GIMPLE_CHECK (s, GIMPLE_CALL); - return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0; -} - - /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return slot optimization. This transformation uses the target of the call expansion as the return slot for calls that return in memory. */ diff --git a/gcc/gimplify.c b/gcc/gimplify.c index cfe6696f5904..f548e7033905 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2449,7 +2449,6 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) CALL_EXPR_RETURN_SLOT_OPT (*expr_p) = CALL_EXPR_RETURN_SLOT_OPT (call); CALL_FROM_THUNK_P (*expr_p) = CALL_FROM_THUNK_P (call); - CALL_CANNOT_INLINE_P (*expr_p) = CALL_CANNOT_INLINE_P (call); SET_EXPR_LOCATION (*expr_p, EXPR_LOCATION (call)); TREE_BLOCK (*expr_p) = TREE_BLOCK (call); diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 9ff247b103a2..21cbecd5cb66 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -1249,7 +1249,7 @@ initialize_inline_failed (struct cgraph_edge *e) e->inline_failed = CIF_BODY_NOT_AVAILABLE; else if (callee->local.redefined_extern_inline) e->inline_failed = CIF_REDEFINED_EXTERN_INLINE; - else if (e->call_stmt && gimple_call_cannot_inline_p (e->call_stmt)) + else if (e->call_stmt_cannot_inline_p) e->inline_failed = CIF_MISMATCHED_ARGUMENTS; else e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index e3c6b3ce824f..59852b5d26b0 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -246,14 +246,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report) struct function *caller_cfun = DECL_STRUCT_FUNCTION (e->caller->decl); struct function *callee_cfun = callee ? DECL_STRUCT_FUNCTION (callee->decl) : NULL; - bool call_stmt_cannot_inline_p; - - /* If E has a call statement in it, use the inline attribute from - the statement, otherwise use the inline attribute in E. Edges - will not have statements when working in WPA mode. */ - call_stmt_cannot_inline_p = (e->call_stmt) - ? gimple_call_cannot_inline_p (e->call_stmt) - : e->call_stmt_cannot_inline_p; if (!caller_cfun && e->caller->clone_of) caller_cfun = DECL_STRUCT_FUNCTION (e->caller->clone_of->decl); @@ -278,7 +270,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report) e->inline_failed = CIF_OVERWRITABLE; return false; } - else if (call_stmt_cannot_inline_p) + else if (e->call_stmt_cannot_inline_p) { e->inline_failed = CIF_MISMATCHED_ARGUMENTS; inlinable = false; @@ -1957,8 +1949,10 @@ early_inliner (void) = estimate_num_insns (edge->call_stmt, &eni_size_weights); es->call_stmt_time = estimate_num_insns (edge->call_stmt, &eni_time_weights); - edge->call_stmt_cannot_inline_p - = gimple_call_cannot_inline_p (edge->call_stmt); + if (edge->callee->decl + && !gimple_check_call_matching_types (edge->call_stmt, + edge->callee->decl)) + edge->call_stmt_cannot_inline_p = true; } timevar_pop (TV_INTEGRATION); iterations++; diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 69f0453ee4f5..25ae3868c314 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1905,13 +1905,10 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, if (new_direct_edge) { new_direct_edge->indirect_inlining_edge = 1; - if (new_direct_edge->call_stmt - && !gimple_check_call_matching_types (new_direct_edge->call_stmt, - new_direct_edge->callee->decl)) - { - gimple_call_set_cannot_inline (new_direct_edge->call_stmt, true); - new_direct_edge->call_stmt_cannot_inline_p = true; - } + if (new_direct_edge->call_stmt) + new_direct_edge->call_stmt_cannot_inline_p + = !gimple_check_call_matching_types (new_direct_edge->call_stmt, + new_direct_edge->callee->decl); if (new_edges) { VEC_safe_push (cgraph_edge_p, heap, *new_edges, @@ -2577,9 +2574,6 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, gimple_set_location (new_stmt, gimple_location (stmt)); gimple_call_set_chain (new_stmt, gimple_call_chain (stmt)); gimple_call_copy_flags (new_stmt, stmt); - if (gimple_call_cannot_inline_p (stmt)) - gimple_call_set_cannot_inline - (new_stmt, !gimple_check_call_matching_types (new_stmt, callee_decl)); if (dump_file && (dump_flags & TDF_DETAILS)) { diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index 9479aebfb342..67fea759459f 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -929,7 +929,6 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp, } /* Transform 1) Memory references. - 2) BUILTIN_ALLOCA calls. */ static void mf_xform_statements (void) @@ -970,16 +969,6 @@ mf_xform_statements (void) } break; - case GIMPLE_CALL: - { - tree fndecl = gimple_call_fndecl (s); - if (fndecl && (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA - || (DECL_FUNCTION_CODE (fndecl) - == BUILT_IN_ALLOCA_WITH_ALIGN))) - gimple_call_set_cannot_inline (s, true); - } - break; - default: ; } diff --git a/gcc/tree.h b/gcc/tree.h index fa4adac5d80c..4544f1ad126b 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -533,9 +533,6 @@ struct GTY(()) tree_common { CASE_HIGH_SEEN in CASE_LABEL_EXPR - CALL_CANNOT_INLINE_P in - CALL_EXPR - ENUM_IS_SCOPED in ENUMERAL_TYPE @@ -1245,9 +1242,6 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define CASE_HIGH_SEEN(NODE) \ (CASE_LABEL_EXPR_CHECK (NODE)->base.static_flag) -/* Used to mark a CALL_EXPR as not suitable for inlining. */ -#define CALL_CANNOT_INLINE_P(NODE) (CALL_EXPR_CHECK (NODE)->base.static_flag) - /* Used to mark scoped enums. */ #define ENUM_IS_SCOPED(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.static_flag) -- 2.43.5