Hi. There's one more similar patch. Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed? Thanks, Martin
>From 466a951d51064a4b339b1332c1723e77e3170150 Mon Sep 17 00:00:00 2001 From: Martin Liska <mli...@suse.cz> Date: Thu, 6 Jun 2019 14:37:45 +0200 Subject: [PATCH] IPA ICF: enhance dump about items in a non-singular class. gcc/ChangeLog: 2019-06-06 Martin Liska <mli...@suse.cz> * ipa-icf.c (sem_item_optimizer::parse_nonsingleton_classes): Update coding style. (sem_item_optimizer::dump_cong_classes): Print how many items are in a non-singular class. Improve coding style. gcc/testsuite/ChangeLog: 2019-06-07 Martin Liska <mli...@suse.cz> * gcc.dg/ipa/pr68035.c: Update scanned pattern. --- gcc/ipa-icf.c | 34 +++++++++++++++--------------- gcc/testsuite/gcc.dg/ipa/pr68035.c | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 6307407935f..7c486eda758 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -2744,20 +2744,20 @@ sem_item_optimizer::build_graph (void) void sem_item_optimizer::parse_nonsingleton_classes (void) { - unsigned int init_called_count = 0; + unsigned int counter = 0; for (unsigned i = 0; i < m_items.length (); i++) if (m_items[i]->cls->members.length () > 1) { m_items[i]->init (); - init_called_count++; + ++counter; } if (dump_file) - fprintf (dump_file, "Init called for %u items (%.2f%%).\n", - init_called_count, - m_items.length () ? 100.0f * init_called_count / m_items.length () - : 0.0f); + { + 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); + } } /* Equality function for semantic items is used to subdivide existing @@ -3274,13 +3274,9 @@ sem_item_optimizer::dump_cong_classes (void) if (!dump_file) return; - fprintf (dump_file, - "Congruence classes: %u (unique hash values: %lu), with total: " - "%u items\n", m_classes_count, - (unsigned long) m_classes.elements (), m_items.length ()); - /* Histogram calculation. */ unsigned int max_index = 0; + unsigned int single_element_classes = 0; unsigned int* histogram = XCNEWVEC (unsigned int, m_items.length () + 1); for (hash_table<congruence_class_hash>::iterator it = m_classes.begin (); @@ -3292,21 +3288,25 @@ sem_item_optimizer::dump_cong_classes (void) if (c > max_index) max_index = c; + + if (c == 1) + ++single_element_classes; } + fprintf (dump_file, + "Congruence classes: %lu with total: %u items (in a non-singular " + "class: %u)\n", (unsigned long) m_classes.elements (), + m_items.length (), m_items.length () - single_element_classes); fprintf (dump_file, "Class size histogram [num of members]: number of classe number " "of classess\n"); - for (unsigned int i = 0; i <= max_index; i++) if (histogram[i]) - fprintf (dump_file, "[%u]: %u classes\n", i, histogram[i]); - - fprintf (dump_file, "\n\n"); + fprintf (dump_file, "%6u: %6u\n", i, histogram[i]); if (dump_flags & TDF_DETAILS) - for (hash_table<congruence_class_hash>::iterator it = m_classes.begin (); - it != m_classes.end (); ++it) + for (hash_table<congruence_class_hash>::iterator it = m_classes.begin (); + it != m_classes.end (); ++it) { fprintf (dump_file, " group: with %u classes:\n", (*it)->classes.length ()); diff --git a/gcc/testsuite/gcc.dg/ipa/pr68035.c b/gcc/testsuite/gcc.dg/ipa/pr68035.c index a8cb77971f6..f6adad9f24d 100644 --- a/gcc/testsuite/gcc.dg/ipa/pr68035.c +++ b/gcc/testsuite/gcc.dg/ipa/pr68035.c @@ -105,4 +105,4 @@ list_49, }; -/* { dg-final { scan-ipa-dump "unique hash values: 51" "icf" } } */ +/* { dg-final { scan-ipa-dump "Congruence classes: 51" "icf" } } */ -- 2.21.0