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 r11-3483] Fix handling of clobbers in ipa-modref.c Date: Sat, 26 Sep 2020 16:41:27 +0000 (GMT) [thread overview] Message-ID: <20200926164127.F14813858D35@sourceware.org> (raw) https://gcc.gnu.org/g:3991912e260d68f0da8d3711b5258c3a3009dc4c commit r11-3483-g3991912e260d68f0da8d3711b5258c3a3009dc4c Author: Jan Hubicka <jh@suse.cz> Date: Sat Sep 26 18:40:50 2020 +0200 Fix handling of clobbers in ipa-modref.c * ipa-modref.c (analyze_stmt): Do not skip clobbers in early pass. * ipa-pure-const.c (analyze_stmt): Update comment. Diff: --- gcc/ipa-modref.c | 11 +++++++---- gcc/ipa-pure-const.c | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 73a7900883a..728c6c1523d 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -676,13 +676,16 @@ static bool analyze_stmt (modref_summary *summary, gimple *stmt, bool ipa, vec <gimple *> *recursive_calls) { - /* There is no need to record clobbers. */ - if (gimple_clobber_p (stmt)) + /* In general we can not ignore clobbers because they are barries for code + motion, however after inlining it is safe to do becuase local optimization + passes do not consider clobbers from other functions. + Similar logic is in ipa-pure-consts. */ + if ((ipa || cfun->after_inlining) && gimple_clobber_p (stmt)) return true; + /* Analyze all loads and stores in STMT. */ walk_stmt_load_store_ops (stmt, summary, analyze_load, analyze_store); - /* or call analyze_load_ipa, analyze_store_ipa */ switch (gimple_code (stmt)) { @@ -705,7 +708,7 @@ analyze_stmt (modref_summary *summary, gimple *stmt, bool ipa, } } -/* Analyze function F. IPA indicates whether we're running in tree mode (false) +/* Analyze function F. IPA indicates whether we're running in local mode (false) or the IPA mode (true). */ static void diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index bdbccd010dc..1af3206056e 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -742,6 +742,8 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa) /* Do consider clobber as side effects before IPA, so we rather inline C++ destructors and keep clobber semantics than eliminate them. + Similar logic is in ipa-modref. + TODO: We may get smarter during early optimizations on these and let functions containing only clobbers to be optimized more. This is a common case of C++ destructors. */
reply other threads:[~2020-09-26 16:41 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=20200926164127.F14813858D35@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).