make use of CALL_FROM_NEW_OR_DELETE_P
authorRichard Biener <rguenther@suse.de>
Thu, 1 Oct 2020 08:44:27 +0000 (10:44 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 2 Oct 2020 09:22:20 +0000 (11:22 +0200)
commit0b945f959f03a6185a3130f30bfd524d01d4142c
treec61ced9467e75d017f2ef2df083b466f5b345aeb
parentb6158faacbfb7d24a1d25b3774bc4338dd849480
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.
gcc/gimple.c
gcc/gimple.h
gcc/ipa-icf-gimple.c
gcc/testsuite/g++.dg/tree-ssa/pta-delete-1.C [new file with mode: 0644]
gcc/tree-ssa-dce.c
gcc/tree-ssa-structalias.c