From 07b8d0afe8c177d096bf77c97f03f41b34bb18cb Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 10 Jun 2019 09:43:11 +0200 Subject: [PATCH] IPA ICF: enhance dump about items in a non-singular class. 2019-06-10 Martin Liska * 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. 2019-06-10 Martin Liska * gcc.dg/ipa/pr68035.c: Update scanned pattern. From-SVN: r272111 --- gcc/ChangeLog | 8 +++++++ gcc/ipa-icf.c | 34 +++++++++++++++--------------- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/ipa/pr68035.c | 2 +- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53547c8df07..5c13d42b107 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-06-10 Martin Liska + + * 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. + 2019-06-10 Martin Liska * value-prof.c (dump_histogram_value): Change dump format. 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::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::iterator it = m_classes.begin (); - it != m_classes.end (); ++it) + for (hash_table::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/ChangeLog b/gcc/testsuite/ChangeLog index bbb6b0b90cb..b1f8b303084 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-06-10 Martin Liska + + * gcc.dg/ipa/pr68035.c: Update scanned pattern. + 2019-06-10 Iain Sandoe * gcc.dg/attr-copy-6.c: Require alias support. 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.30.2