diff options
author | Martin Jambor <mjambor@suse.cz> | 2019-11-07 11:55:43 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2019-11-07 11:55:43 +0100 |
commit | 7313607478c11e9455a32fb0dbfd7867e04ea96a (patch) | |
tree | 9d440c3b3504f391067881779bf98569f28ecf21 /gcc/cgraph.c | |
parent | 0775830a79bad1cdaa8fe279da7cbed123f696b6 (diff) | |
download | gcc-7313607478c11e9455a32fb0dbfd7867e04ea96a.zip gcc-7313607478c11e9455a32fb0dbfd7867e04ea96a.tar.gz gcc-7313607478c11e9455a32fb0dbfd7867e04ea96a.tar.bz2 |
Remove gimple_call_types_likely_match_p (PR 70929)
2019-11-07 Martin Jambor <mjambor@suse.cz>
PR lto/70929
* cif-code.def (MISMATCHED_ARGUMENTS): Removed.
* cgraph.h (gimple_check_call_matching_types): Remove
* cgraph.c (gimple_check_call_args): Likewise.
(gimple_check_call_matching_types): Likewise.
(symbol_table::create_edge): Do not call
gimple_check_call_matching_types.
(cgraph_edge::make_direct): Likewise.
(cgraph_edge::redirect_call_stmt_to_callee): Likewise.
* value-prof.h (check_ic_target): Remove.
* value-prof.c (check_ic_target): Remove.
(gimple_ic_transform): Do nat call check_ic_target.
* auto-profile.c (function_instance::find_icall_target_map): Likewise.
(afdo_indirect_call): Likewise.
* ipa-prop.c (update_indirect_edges_after_inlining): Do not call
gimple_check_call_matching_types.
* ipa-inline.c (early_inliner): Likewise.
testsuite/
* g++.dg/lto/pr70929_[01].C: New test.
* gcc.dg/winline-10.c: Adjust for the fact that inlining happens.
From-SVN: r277920
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 139 |
1 files changed, 3 insertions, 136 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 896a3fc..6ba650e 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -881,19 +881,8 @@ symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee, edge->can_throw_external = call_stmt ? stmt_can_throw_external (DECL_STRUCT_FUNCTION (caller->decl), call_stmt) : false; - if (call_stmt - && callee && callee->decl - && !gimple_check_call_matching_types (call_stmt, callee->decl, - false)) - { - edge->inline_failed = CIF_MISMATCHED_ARGUMENTS; - edge->call_stmt_cannot_inline_p = true; - } - else - { - edge->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; - edge->call_stmt_cannot_inline_p = false; - } + edge->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; + edge->call_stmt_cannot_inline_p = false; if (opt_for_fn (edge->caller->decl, flag_devirtualize) && call_stmt && DECL_STRUCT_FUNCTION (caller->decl)) @@ -1255,13 +1244,6 @@ cgraph_edge::make_direct (cgraph_node *callee) /* Insert to callers list of the new callee. */ edge->set_callee (callee); - if (call_stmt - && !gimple_check_call_matching_types (call_stmt, callee->decl, false)) - { - call_stmt_cannot_inline_p = true; - inline_failed = CIF_MISMATCHED_ARGUMENTS; - } - /* We need to re-determine the inlining status of the edge. */ initialize_inline_failed (edge); return edge; @@ -1290,28 +1272,9 @@ cgraph_edge::redirect_call_stmt_to_callee (void) substitution), forget about speculating. */ if (decl) e = e->resolve_speculation (decl); - /* If types do not match, speculation was likely wrong. - The direct edge was possibly redirected to the clone with a different - signature. We did not update the call statement yet, so compare it - with the reference that still points to the proper type. */ - else if (!gimple_check_call_matching_types (e->call_stmt, - ref->referred->decl, - true)) - { - if (dump_file) - fprintf (dump_file, "Not expanding speculative call of %s -> %s\n" - "Type mismatch.\n", - e->caller->dump_name (), - e->callee->dump_name ()); - e = e->resolve_speculation (); - /* We are producing the final function body and will throw away the - callgraph edges really soon. Reset the counts/frequencies to - keep verifier happy in the case of roundoff errors. */ - e->count = gimple_bb (e->call_stmt)->count; - } - /* Expand speculation into GIMPLE code. */ else { + /* Expand speculation into GIMPLE code. */ if (dump_file) { fprintf (dump_file, @@ -3638,102 +3601,6 @@ cgraph_node::get_fun () const return fun; } -/* Verify if the type of the argument matches that of the function - declaration. If we cannot verify this or there is a mismatch, - return false. */ - -static bool -gimple_check_call_args (gimple *stmt, tree fndecl, bool args_count_match) -{ - tree parms, p; - unsigned int i, nargs; - - /* Calls to internal functions always match their signature. */ - if (gimple_call_internal_p (stmt)) - return true; - - nargs = gimple_call_num_args (stmt); - - /* Get argument types for verification. */ - if (fndecl) - parms = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); - else - parms = TYPE_ARG_TYPES (gimple_call_fntype (stmt)); - - /* Verify if the type of the argument matches that of the function - declaration. If we cannot verify this or there is a mismatch, - return false. */ - if (fndecl && DECL_ARGUMENTS (fndecl)) - { - for (i = 0, p = DECL_ARGUMENTS (fndecl); - i < nargs; - i++, p = DECL_CHAIN (p)) - { - tree arg; - /* We cannot distinguish a varargs function from the case - of excess parameters, still deferring the inlining decision - to the callee is possible. */ - if (!p) - break; - arg = gimple_call_arg (stmt, i); - if (p == error_mark_node - || DECL_ARG_TYPE (p) == error_mark_node - || arg == error_mark_node - || (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg)) - && !fold_convertible_p (DECL_ARG_TYPE (p), arg))) - return false; - } - if (args_count_match && p) - return false; - } - else if (parms) - { - for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p)) - { - tree arg; - /* If this is a varargs function defer inlining decision - to callee. */ - if (!p) - break; - arg = gimple_call_arg (stmt, i); - if (TREE_VALUE (p) == error_mark_node - || arg == error_mark_node - || TREE_CODE (TREE_VALUE (p)) == VOID_TYPE - || (!types_compatible_p (TREE_VALUE (p), TREE_TYPE (arg)) - && !fold_convertible_p (TREE_VALUE (p), arg))) - return false; - } - } - else - { - if (nargs != 0) - return false; - } - return true; -} - -/* Verify if the type of the argument and lhs of CALL_STMT matches - that of the function declaration CALLEE. If ARGS_COUNT_MATCH is - true, the arg count needs to be the same. - If we cannot verify this or there is a mismatch, return false. */ - -bool -gimple_check_call_matching_types (gimple *call_stmt, tree callee, - bool args_count_match) -{ - tree lhs; - - if ((DECL_RESULT (callee) - && !DECL_BY_REFERENCE (DECL_RESULT (callee)) - && (lhs = gimple_call_lhs (call_stmt)) != NULL_TREE - && !useless_type_conversion_p (TREE_TYPE (DECL_RESULT (callee)), - TREE_TYPE (lhs)) - && !fold_convertible_p (TREE_TYPE (DECL_RESULT (callee)), lhs)) - || !gimple_check_call_args (call_stmt, callee, args_count_match)) - return false; - return true; -} - /* Reset all state within cgraph.c so that we can rerun the compiler within the same process. For use by toplev::finalize. */ |