public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5060] Merge IPA solution with local one in ipa-modref Date: Tue, 9 Nov 2021 15:48:39 +0000 (GMT) [thread overview] Message-ID: <20211109154839.9D7D13858401@sourceware.org> (raw) https://gcc.gnu.org/g:7798ae1a15055fe956978453ea62932d680ace72 commit r12-5060-g7798ae1a15055fe956978453ea62932d680ace72 Author: Jan Hubicka <hubicka@ucw.cz> Date: Tue Nov 9 16:48:09 2021 +0100 Merge IPA solution with local one in ipa-modref gcc/ChangeLog: * ipa-modref.c (analyze_parms): Add past_flags, past_retslot_flags and past_static_chain; merge past summary with current one. (analyze_function): Update. Diff: --- gcc/ipa-modref.c | 87 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 18 deletions(-) diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 4429bcea803..2f91b563745 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -2318,11 +2318,18 @@ modref_eaf_analysis::record_escape_points (tree name, int parm_index, int flags) } } -/* Determine EAF flags for function parameters. */ +/* Determine EAF flags for function parameters + and fill in SUMMARY/SUMMARY_LTO. If IPA is true work in IPA mode + where we also collect scape points. + PAST_FLAGS, PAST_RETSLOT_FLAGS, PAST_STATIC_CHAIN_FLAGS can be + used to preserve flags from prevoius (IPA) run for cases where + late optimizations changed code in a way we can no longer analyze + it easily. */ static void analyze_parms (modref_summary *summary, modref_summary_lto *summary_lto, - bool ipa) + bool ipa, vec<eaf_flags_t> &past_flags, + int past_retslot_flags, int past_static_chain_flags) { unsigned int parm_index = 0; unsigned int count = 0; @@ -2395,6 +2402,25 @@ analyze_parms (modref_summary *summary, modref_summary_lto *summary_lto, flags = remove_useless_eaf_flags (flags, ecf_flags, VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))); + if (past_flags.length () > parm_index) + { + int past = past_flags[parm_index]; + past = remove_useless_eaf_flags + (past, ecf_flags, + VOID_TYPE_P (TREE_TYPE + (TREE_TYPE (current_function_decl)))); + if (dump_file && (flags | past) != flags && !(flags & EAF_UNUSED)) + { + fprintf (dump_file, + " Flags for param %i combined with IPA pass:", + (int)parm_index); + dump_eaf_flags (dump_file, past, false); + fprintf (dump_file, " local "); + dump_eaf_flags (dump_file, flags | past, true); + } + if (!(flags & EAF_UNUSED)) + flags |= past; + } if (flags) { @@ -2416,8 +2442,23 @@ analyze_parms (modref_summary *summary, modref_summary_lto *summary_lto, if (retslot) { int flags = eaf_analysis.get_ssa_name_flags (retslot); + int past = past_retslot_flags; flags = remove_useless_eaf_flags (flags, ecf_flags, false); + past = remove_useless_eaf_flags + (past, ecf_flags, + VOID_TYPE_P (TREE_TYPE + (TREE_TYPE (current_function_decl)))); + if (dump_file && (flags | past) != flags && !(flags & EAF_UNUSED)) + { + fprintf (dump_file, + " Retslot flags combined with IPA pass:"); + dump_eaf_flags (dump_file, past, false); + fprintf (dump_file, " local "); + dump_eaf_flags (dump_file, flags, true); + } + if (!(flags & EAF_UNUSED)) + flags |= past; if (flags) { if (summary) @@ -2431,8 +2472,23 @@ analyze_parms (modref_summary *summary, modref_summary_lto *summary_lto, if (static_chain) { int flags = eaf_analysis.get_ssa_name_flags (static_chain); + int past = past_static_chain_flags; flags = remove_useless_eaf_flags (flags, ecf_flags, false); + past = remove_useless_eaf_flags + (past, ecf_flags, + VOID_TYPE_P (TREE_TYPE + (TREE_TYPE (current_function_decl)))); + if (dump_file && (flags | past) != flags && !(flags & EAF_UNUSED)) + { + fprintf (dump_file, + " Static chain flags combined with IPA pass:"); + dump_eaf_flags (dump_file, past, false); + fprintf (dump_file, " local "); + dump_eaf_flags (dump_file, flags, true); + } + if (!(flags & EAF_UNUSED)) + lags |= past; if (flags) { if (summary) @@ -2567,7 +2623,8 @@ analyze_function (function *f, bool ipa) summary_lto->writes_errno = false; } - analyze_parms (summary, summary_lto, ipa); + analyze_parms (summary, summary_lto, ipa, + past_flags, past_retslot_flags, past_static_chain_flags); int ecf_flags = flags_from_decl_or_type (current_function_decl); auto_vec <gimple *, 32> recursive_calls; @@ -2662,15 +2719,12 @@ analyze_function (function *f, bool ipa) VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))); if (old_flags != new_flags) { - if ((old_flags & ~new_flags) == 0) + if ((old_flags & ~new_flags) == 0 + || (new_flags & EAF_UNUSED)) fprintf (dump_file, " Flags for param %i improved:", (int)i); - else if ((new_flags & ~old_flags) == 0) - fprintf (dump_file, " Flags for param %i worsened:", - (int)i); else - fprintf (dump_file, " Flags for param %i changed:", - (int)i); + gcc_unreachable (); dump_eaf_flags (dump_file, old_flags, false); fprintf (dump_file, " -> "); dump_eaf_flags (dump_file, new_flags, true); @@ -2682,12 +2736,11 @@ analyze_function (function *f, bool ipa) VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))); if (past_retslot_flags != summary->retslot_flags) { - if ((past_retslot_flags & ~summary->retslot_flags) == 0) + if ((past_retslot_flags & ~summary->retslot_flags) == 0 + || (summary->retslot_flags & EAF_UNUSED)) fprintf (dump_file, " Flags for retslot improved:"); - else if ((summary->retslot_flags & ~past_retslot_flags) == 0) - fprintf (dump_file, " Flags for retslot worsened:"); else - fprintf (dump_file, " Flags for retslot changed:"); + gcc_unreachable (); dump_eaf_flags (dump_file, past_retslot_flags, false); fprintf (dump_file, " -> "); dump_eaf_flags (dump_file, summary->retslot_flags, true); @@ -2698,13 +2751,11 @@ analyze_function (function *f, bool ipa) VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))); if (past_static_chain_flags != summary->static_chain_flags) { - if ((past_static_chain_flags & ~summary->static_chain_flags) == 0) + if ((past_static_chain_flags & ~summary->static_chain_flags) == 0 + || (summary->static_chain_flags & EAF_UNUSED)) fprintf (dump_file, " Flags for static chain improved:"); - else if ((summary->static_chain_flags - & ~past_static_chain_flags) == 0) - fprintf (dump_file, " Flags for static chain worsened:"); else - fprintf (dump_file, " Flags for static chain changed:"); + gcc_unreachable (); dump_eaf_flags (dump_file, past_static_chain_flags, false); fprintf (dump_file, " -> "); dump_eaf_flags (dump_file, summary->static_chain_flags, true);
reply other threads:[~2021-11-09 15:48 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211109154839.9D7D13858401@sourceware.org \ --to=hubicka@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).