Mark necessary 2nd and later args for delete op.
authorMartin Liska <mliska@suse.cz>
Wed, 31 Jul 2019 10:02:30 +0000 (12:02 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 31 Jul 2019 10:02:30 +0000 (10:02 +0000)
2019-07-31  Martin Liska  <mliska@suse.cz>

* 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
gcc/tree-ssa-dce.c

index c7b99f2ef26655e9473897fae8733e22b475ea14..564bd70c4c91eb781b895109b548ce86bbefe383 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-31  Martin Liska  <mliska@suse.cz>
+
+       * 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  <rguenther@suse.de>
 
        PR tree-optimization/91178
index bec13cd593092ba67e2413f26b7dd3119179e3fb..80d5f5c30f7f4bbe209db5357414ff443ee88b5f 100644 (file)
@@ -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;
                }