diff options
author | Richard Biener <rguenther@suse.de> | 2020-10-01 10:44:27 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-10-02 11:22:20 +0200 |
commit | 0b945f959f03a6185a3130f30bfd524d01d4142c (patch) | |
tree | c61ced9467e75d017f2ef2df083b466f5b345aeb /gcc/tree-ssa-structalias.c | |
parent | b6158faacbfb7d24a1d25b3774bc4338dd849480 (diff) | |
download | gcc-0b945f959f03a6185a3130f30bfd524d01d4142c.zip gcc-0b945f959f03a6185a3130f30bfd524d01d4142c.tar.gz gcc-0b945f959f03a6185a3130f30bfd524d01d4142c.tar.bz2 |
make use of CALL_FROM_NEW_OR_DELETE_P
This fixes points-to analysis and DCE to only consider new/delete
operator calls from new or delete expressions and not direct calls.
2020-10-01 Richard Biener <rguenther@suse.de>
* gimple.h (GF_CALL_FROM_NEW_OR_DELETE): New call flag.
(gimple_call_set_from_new_or_delete): New.
(gimple_call_from_new_or_delete): Likewise.
* gimple.c (gimple_build_call_from_tree): Set
GF_CALL_FROM_NEW_OR_DELETE appropriately.
* ipa-icf-gimple.c (func_checker::compare_gimple_call):
Compare gimple_call_from_new_or_delete.
* tree-ssa-dce.c (mark_all_reaching_defs_necessary_1): Make
sure to only consider new/delete calls from new or delete
expressions.
(propagate_necessity): Likewise.
(eliminate_unnecessary_stmts): Likewise.
* tree-ssa-structalias.c (find_func_aliases_for_call):
Likewise.
* g++.dg/tree-ssa/pta-delete-1.C: New testcase.
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index f676bf9..69de932 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4857,7 +4857,13 @@ 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)) + /* If the call is to a replaceable operator delete and results + from a delete expression as opposed to a direct call to + such operator, then the effects for PTA (in particular + the escaping of the pointer) can be ignored. */ + else if (fndecl + && DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (fndecl) + && gimple_call_from_new_or_delete (t)) ; else handle_rhs_call (t, &rhsc); |