diff options
author | Martin Jambor <mjambor@suse.cz> | 2020-06-04 17:03:27 +0200 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2020-06-04 17:03:27 +0200 |
commit | 1980ffec48c6fa41396bea66366f2e591798e1e1 (patch) | |
tree | 6d6a02b3b314205c6b1dd91fb644dafd4ee94753 /gcc/tree-eh.c | |
parent | 9a810e57c4e6af54d29c325a013f451ade2b85e8 (diff) | |
download | gcc-1980ffec48c6fa41396bea66366f2e591798e1e1.zip gcc-1980ffec48c6fa41396bea66366f2e591798e1e1.tar.gz gcc-1980ffec48c6fa41396bea66366f2e591798e1e1.tar.bz2 |
ipa-sra: Do not remove statements necessary because of non-call EH (PR 95113)
PR 95113 revealed that when reasoning about which parameters are dead,
IPA-SRA does not perform the same check related to non-call exceptions
as tree DCE. It most certainly should and so this patch moves the
condition used in tree-ssa-dce.c into a separate predicate (in
tree-eh.c) and uses it from both places.
gcc/ChangeLog:
2020-05-27 Martin Jambor <mjambor@suse.cz>
PR ipa/95113
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Move non-call
exceptions check to...
* tree-eh.c (stmt_unremovable_because_of_non_call_eh_p): ...this
new function.
* tree-eh.h (stmt_unremovable_because_of_non_call_eh_p): Declare it.
* ipa-sra.c (isra_track_scalar_value_uses): Use it. New parameter
fun.
gcc/testsuite/ChangeLog:
2020-05-27 Martin Jambor <mjambor@suse.cz>
PR ipa/95113
* gcc.dg/ipa/pr95113.c: New test.
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r-- | gcc/tree-eh.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 10ef2e3..4246dca 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -2936,6 +2936,16 @@ stmt_could_throw_p (function *fun, gimple *stmt) } } +/* Return true if STMT in function FUN must be assumed necessary because of + non-call exceptions. */ + +bool +stmt_unremovable_because_of_non_call_eh_p (function *fun, gimple *stmt) +{ + return (fun->can_throw_non_call_exceptions + && !fun->can_delete_dead_exceptions + && stmt_could_throw_p (fun, stmt)); +} /* Return true if expression T could throw an exception. */ |