aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-10-01 10:44:27 +0200
committerRichard Biener <rguenther@suse.de>2020-10-02 11:22:20 +0200
commit0b945f959f03a6185a3130f30bfd524d01d4142c (patch)
treec61ced9467e75d017f2ef2df083b466f5b345aeb /gcc/gimple.c
parentb6158faacbfb7d24a1d25b3774bc4338dd849480 (diff)
downloadgcc-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.c')
-rw-r--r--gcc/gimple.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index fd4e0fa..f07ddab 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -387,6 +387,10 @@ gimple_build_call_from_tree (tree t, tree fnptrtype)
&& fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
&& ALLOCA_FUNCTION_CODE_P (DECL_FUNCTION_CODE (fndecl)))
gimple_call_set_alloca_for_var (call, CALL_ALLOCA_FOR_VAR_P (t));
+ else if (fndecl
+ && (DECL_IS_OPERATOR_NEW_P (fndecl)
+ || DECL_IS_OPERATOR_DELETE_P (fndecl)))
+ gimple_call_set_from_new_or_delete (call, CALL_FROM_NEW_OR_DELETE_P (t));
else
gimple_call_set_from_thunk (call, CALL_FROM_THUNK_P (t));
gimple_call_set_va_arg_pack (call, CALL_EXPR_VA_ARG_PACK (t));