public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges Date: Thu, 8 Jun 2023 10:59:58 +0000 (GMT) [thread overview] Message-ID: <20230608105958.189B3385781F@sourceware.org> (raw) https://gcc.gnu.org/g:ee0b72472022bdb4a796c1c1ec2d049496f12183 commit ee0b72472022bdb4a796c1c1ec2d049496f12183 Author: Alexandre Oliva <oliva@adacore.com> Date: Thu Jun 8 01:43:13 2023 -0300 [strub] tolerate call_stmt-less cgraph_edges cgraph::analyze creates cgraph_edges without call_stmt for thunks. Skip edges without a call_stmt all over. for gcc/ChangeLog * ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL call_stmt in cgraph_edges. (called_directly_with_type_override_p): Likewise. (can_strub_internally_p): Likewise. (distinctify_node_type): Likewise. (verify_strub): Likewise. (pass_ipa_strub::adjust_at_calls_calls): Likewise. (pass_ipa_strub::execute): Likewise. (pass_ipa_strub::adjust_at_calls_call): Require a call_stmt. Diff: --- gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc index d61b7e2e36e..5fc4fca550d 100644 --- a/gcc/ipa-strub.cc +++ b/gcc/ipa-strub.cc @@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false) if (!report) break; - sorry_at (gimple_location (e->call_stmt), + sorry_at (e->call_stmt + ? gimple_location (e->call_stmt) + : DECL_SOURCE_LOCATION (node->decl), "at-calls %<strub%> does not support call to %qD", cdecl); } @@ -607,7 +609,7 @@ static bool called_directly_with_type_override_p (cgraph_node *node, void *) { for (cgraph_edge *e = node->callers; e; e = e->next_caller) - if (strub_call_fntype_override_p (e->call_stmt)) + if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt)) return true; return false; @@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false) if (!report) return result; - sorry_at (gimple_location (e->call_stmt), + sorry_at (e->call_stmt + ? gimple_location (e->call_stmt) + : DECL_SOURCE_LOCATION (node->decl), "%qD is not eligible for internal %<strub%> " "because it calls %qD", node->decl, cdecl); @@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node) we'll adjust their fntypes then. */ for (cgraph_edge *e = node->callers; e; e = e->next_caller) { + if (!e->call_stmt) + continue; tree fnaddr = gimple_call_fn (e->call_stmt); gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR && TREE_OPERAND (fnaddr, 0) == node->decl); @@ -1494,6 +1500,9 @@ verify_strub () { gcc_checking_assert (e->indirect_unknown_callee); + if (!e->call_stmt) + continue; + enum strub_mode callee_mode = effective_strub_mode_for_call (e->call_stmt, NULL); @@ -1507,6 +1516,9 @@ verify_strub () { gcc_checking_assert (!e->indirect_unknown_callee); + if (!e->call_stmt) + continue; + tree callee_fntype; enum strub_mode callee_mode = effective_strub_mode_for_call (e->call_stmt, &callee_fntype); @@ -2282,6 +2294,7 @@ void pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args, tree callee_fntype) { + gcc_checking_assert (e->call_stmt); gcall *ocall = e->call_stmt; gimple_stmt_iterator gsi = gsi_for_stmt (ocall); @@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node) { gcc_checking_assert (e->indirect_unknown_callee); + if (!e->call_stmt) + continue; + tree callee_fntype; enum strub_mode callee_mode = effective_strub_mode_for_call (e->call_stmt, &callee_fntype); @@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node) { gcc_checking_assert (!e->indirect_unknown_callee); + if (!e->call_stmt) + continue; + tree callee_fntype; enum strub_mode callee_mode = effective_strub_mode_for_call (e->call_stmt, &callee_fntype); @@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *) || is_stdarg || apply_args) for (cgraph_edge *e = nnode->callees, *enext; e; e = enext) { + if (!e->call_stmt) + continue; + gcall *call = e->call_stmt; gimple_stmt_iterator gsi = gsi_for_stmt (call); tree fndecl = e->callee->decl;
next reply other threads:[~2023-06-08 10:59 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-08 10:59 Alexandre Oliva [this message] -- strict thread matches above, loose matches on Subject: below -- 2023-06-09 8:08 Alexandre Oliva 2023-06-09 6:26 Alexandre Oliva 2023-06-09 6:18 Alexandre Oliva 2023-06-08 10:44 Alexandre Oliva 2023-06-08 9:18 Alexandre Oliva 2023-06-08 4:48 Alexandre Oliva
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230608105958.189B3385781F@sourceware.org \ --to=aoliva@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).