From c5281d5013c76f0959a6a9b7952c044aaed7932f Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 29 Oct 2019 09:44:28 +0100 Subject: [PATCH] Remove misleading sorting function in ggc memory report. 2019-10-29 Martin Liska * cgraphunit.c (symbol_table::compile): Remove argument for dump_memory_report. * ggc-common.c (dump_ggc_loc_statistics): Likewise. (compare_final): Remove in order to make report better readable. * ggc.h (dump_ggc_loc_statistics): Remove argument. * mem-stats.h (mem_alloc_description::get_list): Do not pass cmp. (mem_alloc_description::dump): Likewise here. * toplev.c (dump_memory_report): Remove final argument. (finalize): Likewise. * toplev.h (dump_memory_report): Remove argument. 2019-10-29 Martin Liska * lto.c (do_whole_program_analysis): Remove argument. From-SVN: r277557 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/cgraphunit.c | 4 ++-- gcc/ggc-common.c | 19 ++----------------- gcc/ggc.h | 2 +- gcc/lto/ChangeLog | 4 ++++ gcc/lto/lto.c | 6 +++--- gcc/mem-stats.h | 19 ++++++------------- gcc/toplev.c | 6 +++--- gcc/toplev.h | 2 +- 9 files changed, 38 insertions(+), 40 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a85c2ae355c..1942f4e315a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2019-10-29 Martin Liska + + * cgraphunit.c (symbol_table::compile): Remove argument + for dump_memory_report. + * ggc-common.c (dump_ggc_loc_statistics): Likewise. + (compare_final): Remove in order to make report + better readable. + * ggc.h (dump_ggc_loc_statistics): Remove argument. + * mem-stats.h (mem_alloc_description::get_list): + Do not pass cmp. + (mem_alloc_description::dump): Likewise here. + * toplev.c (dump_memory_report): Remove final + argument. + (finalize): Likewise. + * toplev.h (dump_memory_report): Remove argument. + 2019-10-29 Richard Sandiford * config/aarch64/aarch64.c (aarch64_sve_cmp_immediate_p) diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 3f751fa1044..9873b9b7aac 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2604,7 +2604,7 @@ symbol_table::compile (void) if (pre_ipa_mem_report) { fprintf (stderr, "Memory consumption before IPA\n"); - dump_memory_report (false); + dump_memory_report (); } if (!quiet_flag) fprintf (stderr, "Performing interprocedural optimizations\n"); @@ -2639,7 +2639,7 @@ symbol_table::compile (void) if (post_ipa_mem_report) { fprintf (stderr, "Memory consumption after IPA\n"); - dump_memory_report (false); + dump_memory_report (); } timevar_pop (TV_CGRAPHOPT); diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 0968d9769fa..8bc77a0a036 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -933,21 +933,6 @@ public: return s.second->get_balance () - f.second->get_balance (); } - /* Compare rows in final GGC summary dump. */ - static int - compare_final (const void *first, const void *second) - { - typedef std::pair mem_pair_t; - - const ggc_usage *f = ((const mem_pair_t *)first)->second; - const ggc_usage *s = ((const mem_pair_t *)second)->second; - - size_t a = f->m_allocated + f->m_overhead - f->m_freed; - size_t b = s->m_allocated + s->m_overhead - s->m_freed; - - return a == b ? 0 : (a < b ? 1 : -1); - } - /* Dump header with NAME. */ static inline void dump_header (const char *name) @@ -970,7 +955,7 @@ static mem_alloc_description ggc_mem_desc; /* Dump per-site memory statistics. */ void -dump_ggc_loc_statistics (bool final) +dump_ggc_loc_statistics () { if (! GATHER_STATISTICS) return; @@ -978,7 +963,7 @@ dump_ggc_loc_statistics (bool final) ggc_force_collect = true; ggc_collect (); - ggc_mem_desc.dump (GGC_ORIGIN, final ? ggc_usage::compare_final : NULL); + ggc_mem_desc.dump (GGC_ORIGIN); ggc_force_collect = false; } diff --git a/gcc/ggc.h b/gcc/ggc.h index 31606dc843f..64d1f188eb0 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -149,7 +149,7 @@ extern void *ggc_realloc (void *, size_t CXX_MEM_STAT_INFO); /* Free a block. To be used when known for certain it's not reachable. */ extern void ggc_free (void *); -extern void dump_ggc_loc_statistics (bool); +extern void dump_ggc_loc_statistics (); /* Reallocator. */ #define GGC_RESIZEVEC(T, P, N) \ diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 5d26f6a1979..2aefc366701 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2019-10-29 Martin Liska + + * lto.c (do_whole_program_analysis): Remove argument. + 2019-10-24 Jan Hubicka * lto-partition.c (add_symbol_to_partition_1): Update. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 9b8c3272977..5dca73ffdb3 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -457,7 +457,7 @@ do_whole_program_analysis (void) if (pre_ipa_mem_report) { fprintf (stderr, "Memory consumption before IPA\n"); - dump_memory_report (false); + dump_memory_report (); } symtab->function_flags_ready = true; @@ -539,14 +539,14 @@ do_whole_program_analysis (void) if (post_ipa_mem_report) { fprintf (stderr, "Memory consumption after IPA\n"); - dump_memory_report (false); + dump_memory_report (); } /* Show the LTO report before launching LTRANS. */ if (flag_lto_report || (flag_wpa && flag_lto_report_wpa)) print_lto_report_1 (); if (mem_report_wpa) - dump_memory_report (true); + dump_memory_report (); } /* Create artificial pointers for "omp declare target link" vars. */ diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h index 9ceb9ccc55b..c2329c2b14d 100644 --- a/gcc/mem-stats.h +++ b/gcc/mem-stats.h @@ -361,14 +361,11 @@ public: are filtered by ORIGIN type, LENGTH is return value where we register the number of elements in the list. If we want to process custom order, CMP comparator can be provided. */ - mem_list_t *get_list (mem_alloc_origin origin, unsigned *length, - int (*cmp) (const void *first, - const void *second) = NULL); + mem_list_t *get_list (mem_alloc_origin origin, unsigned *length); /* Dump all tracked instances of type ORIGIN. If we want to process custom order, CMP comparator can be provided. */ - void dump (mem_alloc_origin origin, - int (*cmp) (const void *first, const void *second) = NULL); + void dump (mem_alloc_origin origin); /* Reverse object map used for every object allocation mapping. */ reverse_object_map_t *m_reverse_object_map; @@ -593,9 +590,7 @@ mem_alloc_description::~mem_alloc_description () template inline typename mem_alloc_description::mem_list_t * -mem_alloc_description::get_list (mem_alloc_origin origin, unsigned *length, - int (*cmp) (const void *first, - const void *second)) +mem_alloc_description::get_list (mem_alloc_origin origin, unsigned *length) { /* vec data structure is not used because all vectors generate memory allocation info a it would create a cycle. */ @@ -608,7 +603,7 @@ mem_alloc_description::get_list (mem_alloc_origin origin, unsigned *length, if ((*it).first->m_origin == origin) list[i++] = std::pair (*it); - qsort (list, i, element_size, cmp == NULL ? T::compare : cmp); + qsort (list, i, element_size, T::compare); *length = i; return list; @@ -637,15 +632,13 @@ mem_alloc_description::get_sum (mem_alloc_origin origin) template inline void -mem_alloc_description::dump (mem_alloc_origin origin, - int (*cmp) (const void *first, - const void *second)) +mem_alloc_description::dump (mem_alloc_origin origin) { unsigned length; fprintf (stderr, "\n"); - mem_list_t *list = get_list (origin, &length, cmp); + mem_list_t *list = get_list (origin, &length); T total = get_sum (origin); T::print_dash_line (); diff --git a/gcc/toplev.c b/gcc/toplev.c index 1c7002f5c37..8a152b8e3b1 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1994,7 +1994,7 @@ target_reinit (void) } void -dump_memory_report (bool final) +dump_memory_report () { dump_line_table_statistics (); ggc_print_statistics (); @@ -2006,7 +2006,7 @@ dump_memory_report (bool final) dump_bitmap_statistics (); dump_hash_table_loc_statistics (); dump_vec_loc_statistics (); - dump_ggc_loc_statistics (final); + dump_ggc_loc_statistics (); dump_alias_stats (stderr); dump_pta_stats (stderr); } @@ -2058,7 +2058,7 @@ finalize (bool no_backend) } if (mem_report) - dump_memory_report (true); + dump_memory_report (); if (profile_report) dump_profile_report (); diff --git a/gcc/toplev.h b/gcc/toplev.h index 48cb10c997e..91e346570db 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -66,7 +66,7 @@ extern bool wrapup_global_declarations (tree *, int); extern void global_decl_processing (void); -extern void dump_memory_report (bool); +extern void dump_memory_report (); extern void dump_profile_report (void); extern void target_reinit (void); -- 2.30.2