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/gimple.h | |
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/gimple.h')
-rw-r--r-- | gcc/gimple.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h index 6cc7e66..108ae84 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -149,6 +149,7 @@ enum gf_mask { GF_CALL_MUST_TAIL_CALL = 1 << 9, GF_CALL_BY_DESCRIPTOR = 1 << 10, GF_CALL_NOCF_CHECK = 1 << 11, + GF_CALL_FROM_NEW_OR_DELETE = 1 << 12, GF_OMP_PARALLEL_COMBINED = 1 << 0, GF_OMP_TASK_TASKLOOP = 1 << 0, GF_OMP_TASK_TASKWAIT = 1 << 1, @@ -3387,6 +3388,29 @@ gimple_call_from_thunk_p (gcall *s) } +/* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call + to operator new or delete created from a new or delete expression. */ + +static inline void +gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p) +{ + if (from_new_or_delete_p) + s->subcode |= GF_CALL_FROM_NEW_OR_DELETE; + else + s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE; +} + + +/* Return true if GIMPLE_CALL S is a call to operator new or delete from + from a new or delete expression. */ + +static inline bool +gimple_call_from_new_or_delete (gcall *s) +{ + return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0; +} + + /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the argument pack in its argument list. */ |