From: Martin Liska Date: Thu, 14 Nov 2019 08:35:48 +0000 (+0100) Subject: Update statistics about needed symbols in IPA ICF. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5d97670f7ab593223149b2b74fd96d9da79945b2;p=gcc.git Update statistics about needed symbols in IPA ICF. 2019-11-14 Martin Liska * ipa-icf.c (sem_item_optimizer::execute): Save loaded_symbols. (sem_item_optimizer::parse_nonsingleton_classes): Return number of loaded symbols. (sem_item_optimizer::merge_classes): Print statistics about totally needed symbols. * ipa-icf.h (parse_nonsingleton_classes): Change return type. (merge_classes): Add one argument. From-SVN: r278209 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50b9032365b..e0f2a210196 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-11-14 Martin Liska + + * ipa-icf.c (sem_item_optimizer::execute): Save + loaded_symbols. + (sem_item_optimizer::parse_nonsingleton_classes): + Return number of loaded symbols. + (sem_item_optimizer::merge_classes): Print + statistics about totally needed symbols. + * ipa-icf.h (parse_nonsingleton_classes): Change return + type. + (merge_classes): Add one argument. + 2019-11-14 Martin Liska * ipa-icf-gimple.c (func_checker::hash_operand): Improve diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 8297eec9388..15aac1cdbe6 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -2400,7 +2400,7 @@ sem_item_optimizer::execute (void) dump_cong_classes (); - parse_nonsingleton_classes (); + unsigned int loaded_symbols = parse_nonsingleton_classes (); subdivide_classes_by_equality (); if (dump_file) @@ -2413,7 +2413,7 @@ sem_item_optimizer::execute (void) process_cong_reduction (); dump_cong_classes (); checking_verify_classes (); - bool merged_p = merge_classes (prev_class_count); + bool merged_p = merge_classes (prev_class_count, loaded_symbols); if (dump_file && (dump_flags & TDF_DETAILS)) symtab->dump (dump_file); @@ -2587,7 +2587,7 @@ sem_item_optimizer::build_graph (void) /* Semantic items in classes having more than one element and initialized. In case of WPA, we load function body. */ -void +unsigned int sem_item_optimizer::parse_nonsingleton_classes (void) { unsigned int counter = 0; @@ -2607,6 +2607,8 @@ sem_item_optimizer::parse_nonsingleton_classes (void) float f = m_items.length () ? 100.0f * counter / m_items.length () : 0.0f; fprintf (dump_file, "Init called for %u items (%.2f%%).\n", counter, f); } + + return counter; } /* Equality function for semantic items is used to subdivide existing @@ -3214,10 +3216,12 @@ sort_congruence_class_groups_by_decl_uid (const void *a, const void *b) /* After reduction is done, we can declare all items in a group to be equal. PREV_CLASS_COUNT is start number of classes before reduction. True is returned if there's a merge operation - processed. */ + processed. LOADED_SYMBOLS is number of symbols that were loaded + in WPA. */ bool -sem_item_optimizer::merge_classes (unsigned int prev_class_count) +sem_item_optimizer::merge_classes (unsigned int prev_class_count, + unsigned int loaded_symbols) { unsigned int item_count = m_items.length (); unsigned int class_count = m_classes_count; @@ -3280,8 +3284,10 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count) non_singular_classes_count : 0.0f, non_singular_classes_count); fprintf (dump_file, "Equal symbols: %u\n", equal_items); - fprintf (dump_file, "Fraction of visited symbols: %.2f%%\n\n", - item_count ? 100.0f * equal_items / item_count : 0.0f); + unsigned total = equal_items + non_singular_classes_count; + fprintf (dump_file, "Totally needed symbols: %u" + ", fraction of loaded symbols: %.2f%%\n\n", total, + loaded_symbols ? 100.0f * total / loaded_symbols: 0.0f); } unsigned int l; diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index 906002214d5..3098fd1f0ce 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -546,7 +546,7 @@ private: /* Semantic items in classes having more than one element and initialized. In case of WPA, we load function body. */ - void parse_nonsingleton_classes (void); + unsigned int parse_nonsingleton_classes (void); /* Equality function for semantic items is used to subdivide existing classes. If IN_WPA, fast equality function is invoked. */ @@ -571,8 +571,10 @@ private: /* After reduction is done, we can declare all items in a group to be equal. PREV_CLASS_COUNT is start number of classes before reduction. True is returned if there's a merge operation - processed. */ - bool merge_classes (unsigned int prev_class_count); + processed. LOADED_SYMBOLS is number of symbols that were loaded + in WPA. */ + bool merge_classes (unsigned int prev_class_count, + unsigned int loaded_symbols); /* Fixup points to analysis info. */ void fixup_points_to_sets (void);