Come up with ggc_delete.
authorMartin Liska <mliska@suse.cz>
Mon, 4 Nov 2019 09:11:14 +0000 (10:11 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 4 Nov 2019 09:11:14 +0000 (09:11 +0000)
2019-11-04  Martin Liska  <mliska@suse.cz>

* ggc.h (ggc_delete): New function.
* ipa-fnsummary.c (ipa_free_fn_summary): Use it.
* ipa-prop.c (ipa_free_all_edge_args): Likewise.
(ipa_free_all_node_params): Likewise.
* ipa-sra.c (ipa_sra_analysis): Likewise.

From-SVN: r277767

gcc/ChangeLog
gcc/ggc.h
gcc/ipa-fnsummary.c
gcc/ipa-prop.c
gcc/ipa-sra.c

index c108ac2108d311aa427e669147f20b6fd7c458cd..cdb5791b501d51414ae8e5a12b5520d4d28d55d6 100644 (file)
@@ -1,3 +1,11 @@
+2019-11-04  Martin Liska  <mliska@suse.cz>
+
+       * ggc.h (ggc_delete): New function.
+       * ipa-fnsummary.c (ipa_free_fn_summary): Use it.
+       * ipa-prop.c (ipa_free_all_edge_args): Likewise.
+       (ipa_free_all_node_params): Likewise.
+       * ipa-sra.c (ipa_sra_analysis): Likewise.
+
 2019-11-02  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-fnsummary.c (set_cond_stmt_execution_predicate,
index c22fc37371132953a5c4d6f3995ac78d68e0d0d2..6c64caaafb25b441bda4b2df25df6c1887a7aa55 100644 (file)
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -242,6 +242,16 @@ ggc_alloc_atomic (size_t s CXX_MEM_STAT_INFO)
     return ggc_internal_alloc (s PASS_MEM_STAT);
 }
 
+/* Call destructor and free the garbage collected memory.  */
+
+template <typename T>
+inline void
+ggc_delete (T *ptr)
+{
+  ptr->~T ();
+  ggc_free (ptr);
+}
+
 /* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS.
    If LENGTH is -1, then CONTENTS is assumed to be a
    null-terminated string and the memory sized accordingly.  */
index 4a3cb760a265ba0b5b13eb785a84736b11b17db6..72a01cff6c9f62ba1b36c9fd0fa091a7082cbbc8 100644 (file)
@@ -4136,8 +4136,7 @@ ipa_free_fn_summary (void)
 {
   if (!ipa_call_summaries)
     return;
-  ipa_fn_summaries->~fast_function_summary <ipa_fn_summary *, va_gc> ();
-  ggc_free (ipa_fn_summaries);
+  ggc_delete (ipa_fn_summaries);
   ipa_fn_summaries = NULL;
   delete ipa_call_summaries;
   ipa_call_summaries = NULL;
index 83cf4d1c7bacf94778e19b917aef21e83da9f535..3a6e21bf013fb98e834ff2a0c08472ae01e68e9f 100644 (file)
@@ -3756,8 +3756,7 @@ ipa_free_all_edge_args (void)
   if (!ipa_edge_args_sum)
     return;
 
-  ipa_edge_args_sum->~ipa_edge_args_sum_t ();
-  ggc_free (ipa_edge_args_sum);
+  ggc_delete (ipa_edge_args_sum);
   ipa_edge_args_sum = NULL;
 }
 
@@ -3766,8 +3765,7 @@ ipa_free_all_edge_args (void)
 void
 ipa_free_all_node_params (void)
 {
-  ipa_node_params_sum->~ipa_node_params_t ();
-  ggc_free (ipa_node_params_sum);
+  ggc_delete (ipa_node_params_sum);
   ipa_node_params_sum = NULL;
 }
 
index 8f0284385561ca62751ebaa524ac25f6bee1e27b..7367441b10551c0bfbe2e808c8b042324f77cdb0 100644 (file)
@@ -3989,8 +3989,7 @@ ipa_sra_analysis (void)
     process_isra_node_results (node, clone_num_suffixes);
 
   delete clone_num_suffixes;
-  func_sums->~ipa_sra_function_summaries ();
-  ggc_free (func_sums);
+  ggc_delete (func_sums);
   func_sums = NULL;
   delete call_sums;
   call_sums = NULL;