Sort debug counter names.
diff mbox series

Message ID 6d0bed4c-22ce-9d7f-9352-0d5b6391db76@suse.cz
State New
Headers show
Series
  • Sort debug counter names.
Related show

Commit Message

Martin Liška Nov. 11, 2019, 8:23 a.m. UTC
Hi.

The small patch is about sorting of debug counter
values.

Ready to be installed?
Thanks,
Martin

Comments

Richard Biener Nov. 11, 2019, 2:20 p.m. UTC | #1
On Mon, Nov 11, 2019 at 9:23 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> The small patch is about sorting of debug counter
> values.
>
> Ready to be installed?

OK

> Thanks,
> Martin
Martin Liška Nov. 12, 2019, 7:50 a.m. UTC | #2
On 11/11/19 3:20 PM, Richard Biener wrote:
> On Mon, Nov 11, 2019 at 9:23 AM Martin Liška <mliska@suse.cz> wrote:
>>
>> Hi.
>>
>> The small patch is about sorting of debug counter
>> values.
>>
>> Ready to be installed?
> 
> OK
> 
>> Thanks,
>> Martin

Hi.

There's a small follow up where I enforce the sorting via a selftest.

Ready for trunk?
Thanks,
Martin
Richard Biener Nov. 12, 2019, 8:39 a.m. UTC | #3
On Tue, Nov 12, 2019 at 8:50 AM Martin Liška <mliska@suse.cz> wrote:
>
> On 11/11/19 3:20 PM, Richard Biener wrote:
> > On Mon, Nov 11, 2019 at 9:23 AM Martin Liška <mliska@suse.cz> wrote:
> >>
> >> Hi.
> >>
> >> The small patch is about sorting of debug counter
> >> values.
> >>
> >> Ready to be installed?
> >
> > OK
> >
> >> Thanks,
> >> Martin
>
> Hi.
>
> There's a small follow up where I enforce the sorting via a selftest.

Well, it's either a bit over-engineering unless you also make use of this and
optimize

  int i;
  for (i = debug_counter_number_of_counters - 1; i >= 0; i--)
    if (strcmp (map[i].name, name) == 0)
      break;

no?

> Ready for trunk?
> Thanks,
> Martin
Martin Liška Nov. 12, 2019, 9:01 a.m. UTC | #4
On 11/12/19 9:39 AM, Richard Biener wrote:
> On Tue, Nov 12, 2019 at 8:50 AM Martin Liška <mliska@suse.cz> wrote:
>>
>> On 11/11/19 3:20 PM, Richard Biener wrote:
>>> On Mon, Nov 11, 2019 at 9:23 AM Martin Liška <mliska@suse.cz> wrote:
>>>>
>>>> Hi.
>>>>
>>>> The small patch is about sorting of debug counter
>>>> values.
>>>>
>>>> Ready to be installed?
>>>
>>> OK
>>>
>>>> Thanks,
>>>> Martin
>>
>> Hi.
>>
>> There's a small follow up where I enforce the sorting via a selftest.
> 
> Well, it's either a bit over-engineering unless you also make use of this and
> optimize

My motivation was to preserve sorted list in -dbg-cnt-list.

> 
>    int i;
>    for (i = debug_counter_number_of_counters - 1; i >= 0; i--)
>      if (strcmp (map[i].name, name) == 0)
>        break;
> 
> no?

Heh, that can be rewritten to vec::bsearch, but would need to convert 'map'
to a 'vec' type. Or ideally to use a hash_map, but it will probably not pay back.

I don't insist on the patch :)

Martin

> 
>> Ready for trunk?
>> Thanks,
>> Martin
Richard Biener Nov. 13, 2019, 2:44 p.m. UTC | #5
On Tue, Nov 12, 2019 at 10:01 AM Martin Liška <mliska@suse.cz> wrote:
>
> On 11/12/19 9:39 AM, Richard Biener wrote:
> > On Tue, Nov 12, 2019 at 8:50 AM Martin Liška <mliska@suse.cz> wrote:
> >>
> >> On 11/11/19 3:20 PM, Richard Biener wrote:
> >>> On Mon, Nov 11, 2019 at 9:23 AM Martin Liška <mliska@suse.cz> wrote:
> >>>>
> >>>> Hi.
> >>>>
> >>>> The small patch is about sorting of debug counter
> >>>> values.
> >>>>
> >>>> Ready to be installed?
> >>>
> >>> OK
> >>>
> >>>> Thanks,
> >>>> Martin
> >>
> >> Hi.
> >>
> >> There's a small follow up where I enforce the sorting via a selftest.
> >
> > Well, it's either a bit over-engineering unless you also make use of this and
> > optimize
>
> My motivation was to preserve sorted list in -dbg-cnt-list.

Ah, OK, that makes sense.  OTOH the function printing could just
sort it itself.

> >
> >    int i;
> >    for (i = debug_counter_number_of_counters - 1; i >= 0; i--)
> >      if (strcmp (map[i].name, name) == 0)
> >        break;
> >
> > no?
>
> Heh, that can be rewritten to vec::bsearch, but would need to convert 'map'
> to a 'vec' type. Or ideally to use a hash_map, but it will probably not pay back.
>
> I don't insist on the patch :)

Well, the above motivation is a good one so I guess ... OK.

Richard.

> Martin
>
> >
> >> Ready for trunk?
> >> Thanks,
> >> Martin
>

Patch
diff mbox series

From f9e1387c8e03d73d00d701fa9754af850424215f Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 11 Nov 2019 09:03:24 +0100
Subject: [PATCH] Sort debug counter names.

gcc/ChangeLog:

2019-11-11  Martin Liska  <mliska@suse.cz>

	* dbgcnt.def (DEBUG_COUNTER): Sort counters
	alphabetically.
---
 gcc/dbgcnt.def | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def
index cbd437ea594..5b96a7eaf9d 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -140,7 +140,8 @@  echo ubound: $ub
 
 */
 
-/* Debug counter definitions.  */
+/* Debug counter definitions.
+   Please keep the list sorted in alphabetic order.  */
 DEBUG_COUNTER (asan_use_after_scope)
 DEBUG_COUNTER (auto_inc_dec)
 DEBUG_COUNTER (ccp)
@@ -153,10 +154,12 @@  DEBUG_COUNTER (dce_ud)
 DEBUG_COUNTER (delete_trivial_dead)
 DEBUG_COUNTER (devirt)
 DEBUG_COUNTER (df_byte_scan)
+DEBUG_COUNTER (dom_unreachable_edges)
 DEBUG_COUNTER (dse)
 DEBUG_COUNTER (dse1)
 DEBUG_COUNTER (dse2)
 DEBUG_COUNTER (gcse2_delete)
+DEBUG_COUNTER (gimple_unroll)
 DEBUG_COUNTER (global_alloc_at_func)
 DEBUG_COUNTER (global_alloc_at_reg)
 DEBUG_COUNTER (graphite_scop)
@@ -170,7 +173,9 @@  DEBUG_COUNTER (if_conversion_tree)
 DEBUG_COUNTER (ipa_sra_params)
 DEBUG_COUNTER (ipa_sra_retvalues)
 DEBUG_COUNTER (ira_move)
+DEBUG_COUNTER (ivopts_loop)
 DEBUG_COUNTER (local_alloc_for_sched)
+DEBUG_COUNTER (match)
 DEBUG_COUNTER (merged_ipa_icf)
 DEBUG_COUNTER (postreload_cse)
 DEBUG_COUNTER (pre)
@@ -188,15 +193,11 @@  DEBUG_COUNTER (sel_sched_insn_cnt)
 DEBUG_COUNTER (sel_sched_region_cnt)
 DEBUG_COUNTER (sms_sched_loop)
 DEBUG_COUNTER (split_for_sched2)
+DEBUG_COUNTER (store_merging)
 DEBUG_COUNTER (store_motion)
 DEBUG_COUNTER (stv_conversion)
 DEBUG_COUNTER (tail_call)
-DEBUG_COUNTER (treepre_insert)
 DEBUG_COUNTER (tree_sra)
+DEBUG_COUNTER (treepre_insert)
 DEBUG_COUNTER (vect_loop)
 DEBUG_COUNTER (vect_slp)
-DEBUG_COUNTER (dom_unreachable_edges)
-DEBUG_COUNTER (match)
-DEBUG_COUNTER (store_merging)
-DEBUG_COUNTER (gimple_unroll)
-DEBUG_COUNTER (ivopts_loop)
-- 
2.24.0