This is the 2nd piece of the stmt flag removal. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
I'll apply the short series tomorrow unless there are any objections or comments. Thanks, Richard. 2011-12-02 Richard Guenther <rguent...@suse.de> * 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. Index: trunk/gcc/cgraph.c =================================================================== *** trunk.orig/gcc/cgraph.c 2011-12-02 16:34:42.000000000 +0100 --- trunk/gcc/cgraph.c 2011-12-02 16:39:50.000000000 +0100 *************** cgraph_create_edge_1 (struct cgraph_node *** 988,995 **** 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 && caller->call_site_hash) cgraph_add_edge_to_call_site_hash (edge); --- 988,999 ---- edge->can_throw_external = call_stmt ? stmt_can_throw_external (call_stmt) : false; pop_cfun (); ! 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); *************** cgraph_make_edge_direct (struct cgraph_e *** 1184,1195 **** /* 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; ! } /* We need to re-determine the inlining status of the edge. */ initialize_inline_failed (edge); --- 1188,1196 ---- /* Insert to callers list of the new callee. */ cgraph_set_edge_callee (edge, callee); ! 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); Index: trunk/gcc/gimple-streamer-in.c =================================================================== *** trunk.orig/gcc/gimple-streamer-in.c 2011-12-02 16:34:42.000000000 +0100 --- trunk/gcc/gimple-streamer-in.c 2011-12-02 17:02:35.000000000 +0100 *************** input_gimple_stmt (struct lto_input_bloc *** 219,236 **** } 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; --- 219,229 ---- Index: trunk/gcc/gimple.h =================================================================== *** trunk.orig/gcc/gimple.h 2011-12-02 16:34:42.000000000 +0100 --- trunk/gcc/gimple.h 2011-12-02 16:35:07.000000000 +0100 *************** enum gimple_rhs_class *** 97,110 **** 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_OMP_PARALLEL_COMBINED = 1 << 0, /* True on an GIMPLE_OMP_RETURN statement if the return does not require --- 97,109 ---- enum gf_mask { GF_ASM_INPUT = 1 << 0, GF_ASM_VOLATILE = 1 << 1, ! 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 *************** gimple_call_tail_p (gimple s) *** 2343,2371 **** } - /* 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. */ --- 2342,2347 ---- Index: trunk/gcc/ipa-inline-analysis.c =================================================================== *** trunk.orig/gcc/ipa-inline-analysis.c 2011-12-02 16:34:42.000000000 +0100 --- trunk/gcc/ipa-inline-analysis.c 2011-12-02 16:35:07.000000000 +0100 *************** initialize_inline_failed (struct cgraph_ *** 1249,1255 **** 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)) e->inline_failed = CIF_MISMATCHED_ARGUMENTS; else e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; --- 1249,1255 ---- 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_cannot_inline_p) e->inline_failed = CIF_MISMATCHED_ARGUMENTS; else e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; Index: trunk/gcc/ipa-inline.c =================================================================== *** trunk.orig/gcc/ipa-inline.c 2011-12-02 16:34:42.000000000 +0100 --- trunk/gcc/ipa-inline.c 2011-12-02 16:35:07.000000000 +0100 *************** can_inline_edge_p (struct cgraph_edge *e *** 246,259 **** 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); --- 246,251 ---- *************** can_inline_edge_p (struct cgraph_edge *e *** 278,284 **** e->inline_failed = CIF_OVERWRITABLE; return false; } ! else if (call_stmt_cannot_inline_p) { e->inline_failed = CIF_MISMATCHED_ARGUMENTS; inlinable = false; --- 270,276 ---- e->inline_failed = CIF_OVERWRITABLE; return false; } ! else if (e->call_stmt_cannot_inline_p) { e->inline_failed = CIF_MISMATCHED_ARGUMENTS; inlinable = false; *************** early_inliner (void) *** 1957,1964 **** = 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); } timevar_pop (TV_INTEGRATION); iterations++; --- 1949,1958 ---- = estimate_num_insns (edge->call_stmt, &eni_size_weights); es->call_stmt_time = estimate_num_insns (edge->call_stmt, &eni_time_weights); ! 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++; Index: trunk/gcc/ipa-prop.c =================================================================== *** trunk.orig/gcc/ipa-prop.c 2011-12-02 16:34:42.000000000 +0100 --- trunk/gcc/ipa-prop.c 2011-12-02 16:44:57.000000000 +0100 *************** update_indirect_edges_after_inlining (st *** 1905,1917 **** 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_edges) { VEC_safe_push (cgraph_edge_p, heap, *new_edges, --- 1905,1914 ---- if (new_direct_edge) { new_direct_edge->indirect_inlining_edge = 1; ! 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, *************** ipa_modify_call_arguments (struct cgraph *** 2577,2585 **** 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)) { --- 2574,2579 ---- Index: trunk/gcc/cgraphunit.c =================================================================== *** trunk.orig/gcc/cgraphunit.c 2011-12-02 10:14:44.000000000 +0100 --- trunk/gcc/cgraphunit.c 2011-12-02 16:40:14.000000000 +0100 *************** assemble_thunk (struct cgraph_node *node *** 1694,1700 **** 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); --- 1694,1699 ---- Index: trunk/gcc/gimple-fold.c =================================================================== *** trunk.orig/gcc/gimple-fold.c 2011-11-09 16:14:38.000000000 +0100 --- trunk/gcc/gimple-fold.c 2011-12-02 16:55:15.000000000 +0100 *************** gimple_fold_call (gimple_stmt_iterator * *** 1108,1130 **** } } - /* 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. */ if (callee && DECL_BUILT_IN (callee)) { tree result = gimple_fold_builtin (stmt); --- 1108,1119 ---- } } 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);