From f39b06395e90d8c70548eedadc30e880f6426b26 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 31 Jul 2019 12:02:30 +0200 Subject: [PATCH] Mark necessary 2nd and later args for delete op. 2019-07-31 Martin Liska * tree-ssa-dce.c (propagate_necessity): Delete operator can have size and (or) alignment as 2nd and later arguments. Mark all of them as necessary. From-SVN: r273929 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-dce.c | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7b99f2ef26..564bd70c4c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-31 Martin Liska + + * tree-ssa-dce.c (propagate_necessity): Delete operator can + have size and (or) alignment as 2nd and later arguments. + Mark all of them as necessary. + 2019-07-31 Richard Biener PR tree-optimization/91178 diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index bec13cd5930..80d5f5c30f7 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -824,13 +824,16 @@ propagate_necessity (bool aggressive) || DECL_FUNCTION_CODE (def_callee) == BUILT_IN_CALLOC)) || DECL_IS_REPLACEABLE_OPERATOR_NEW_P (def_callee))) { - /* Some delete operators have size as 2nd argument. */ + /* Delete operators can have alignment and (or) size as next + arguments. When being a SSA_NAME, they must be marked + as necessary. */ if (is_delete_operator && gimple_call_num_args (stmt) >= 2) - { - tree size_argument = gimple_call_arg (stmt, 1); - if (TREE_CODE (size_argument) == SSA_NAME) - mark_operand_necessary (size_argument); - } + for (unsigned i = 1; i < gimple_call_num_args (stmt); i++) + { + tree arg = gimple_call_arg (stmt, i); + if (TREE_CODE (arg) == SSA_NAME) + mark_operand_necessary (arg); + } continue; } -- 2.30.2