diff options
author | Jan Hubicka <jh@suse.cz> | 2020-09-26 18:40:50 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-09-26 18:41:21 +0200 |
commit | 3991912e260d68f0da8d3711b5258c3a3009dc4c (patch) | |
tree | 5de78e6319bce9ec7a26f94f8bc58367c18d89dc | |
parent | 081b3517b4df826ac917147eb906bbb8fc6528b1 (diff) | |
download | gcc-3991912e260d68f0da8d3711b5258c3a3009dc4c.zip gcc-3991912e260d68f0da8d3711b5258c3a3009dc4c.tar.gz gcc-3991912e260d68f0da8d3711b5258c3a3009dc4c.tar.bz2 |
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.
-rw-r--r-- | gcc/ipa-modref.c | 11 | ||||
-rw-r--r-- | 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 73a7900..728c6c1 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 bdbccd0..1af3206 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. */ |