diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-13 20:43:10 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-13 20:43:10 +0000 |
commit | fd499010e6852cdeb1d69b34dbed4c08e758e668 (patch) | |
tree | 766a98f3d5559b55ab94758efb47e41e397866bd /gcc/ipa-pure-const.c | |
parent | d11f9fe74c7bfaab9aab8ef09a6da9cd4f309cbd (diff) | |
download | gcc-fd499010e6852cdeb1d69b34dbed4c08e758e668.tar.gz |
PR c++/70641
* ipa-pure-const.c (pass_nothrow::execute): Call maybe_clean_eh_stmt
on all recursive call stmts. Return TODO_cleanup_cfg if any dead
eh edges have been purged.
* g++.dg/opt/pr70641.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r-- | gcc/ipa-pure-const.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 892bf46d53c..3b3a419a3e3 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -1956,10 +1956,25 @@ pass_nothrow::execute (function *) } node->set_nothrow_flag (true); + + bool cfg_changed = false; + if (self_recursive_p (node)) + FOR_EACH_BB_FN (this_block, cfun) + if (gimple *g = last_stmt (this_block)) + if (is_gimple_call (g)) + { + tree callee_t = gimple_call_fndecl (g); + if (callee_t + && recursive_call_p (current_function_decl, callee_t) + && maybe_clean_eh_stmt (g) + && gimple_purge_dead_eh_edges (this_block)) + cfg_changed = true; + } + if (dump_file) fprintf (dump_file, "Function found to be nothrow: %s\n", current_function_name ()); - return 0; + return cfg_changed ? TODO_cleanup_cfg : 0; } } // anon namespace |