diff options
author | Richard Biener <rguenther@suse.de> | 2020-09-23 10:11:03 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-09-23 10:11:03 +0200 |
commit | 9e64f17d044767248175fece80a2759d94c45fc4 (patch) | |
tree | 0ba70e878d34705b098a986005ee6739a6585b88 | |
parent | 371f0b990f2bbf638b44da27cf6fc5f86e0d6d4e (diff) | |
download | gcc-9e64f17d044767248175fece80a2759d94c45fc4.zip gcc-9e64f17d044767248175fece80a2759d94c45fc4.tar.gz gcc-9e64f17d044767248175fece80a2759d94c45fc4.tar.bz2 |
tree-optimization/97151 - improve PTA for C++ operator delete
C++ operator delete, when DECL_IS_REPLACEABLE_OPERATOR_DELETE_P,
does not cause the deleted object to be escaped. It also has no
other interesting side-effects for PTA so skip it like we do
for BUILT_IN_FREE.
2020-09-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/97151
* tree-ssa-structalias.c (find_func_aliases_for_call):
DECL_IS_REPLACEABLE_OPERATOR_DELETE_P has no effect on
arguments.
* g++.dg/cpp1y/new1.C: Adjust for two more handled transforms.
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/new1.C | 4 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1y/new1.C b/gcc/testsuite/g++.dg/cpp1y/new1.C index aa5f647d..fec0088 100644 --- a/gcc/testsuite/g++.dg/cpp1y/new1.C +++ b/gcc/testsuite/g++.dg/cpp1y/new1.C @@ -69,5 +69,5 @@ test_unused() { delete p; } -/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 5 "cddce1"} } */ -/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 7 "cddce1"} } */ +/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 6 "cddce1"} } */ +/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 8 "cddce1"} } */ diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 44fe52e..f676bf9 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4857,6 +4857,8 @@ find_func_aliases_for_call (struct function *fn, gcall *t) point for reachable memory of their arguments. */ else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE)) handle_pure_call (t, &rhsc); + else if (fndecl && DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (fndecl)) + ; else handle_rhs_call (t, &rhsc); if (gimple_call_lhs (t)) |