Re: [PATCH] Speed up qsort in IPA ICF

2019-09-19 Thread Martin Liška
On 9/19/19 3:18 PM, Richard Biener wrote: > On Thu, Sep 19, 2019 at 3:15 PM Alexander Monakov wrote: >> >> On Thu, 19 Sep 2019, Richard Biener wrote: >> Good point, there's a tested patch. >>> >>> OK. >> >> Hold on, is the new comparator really correct? >> >> >> @@ -3384,20 +3372,11 @@ sort_c

Re: [PATCH] Speed up qsort in IPA ICF

2019-09-19 Thread Richard Biener
On Thu, Sep 19, 2019 at 3:15 PM Alexander Monakov wrote: > > On Thu, 19 Sep 2019, Richard Biener wrote: > > > > Good point, there's a tested patch. > > > > OK. > > Hold on, is the new comparator really correct? > > > @@ -3384,20 +3372,11 @@ sort_congruence_classes_by_decl_uid (const void *a, > co

Re: [PATCH] Speed up qsort in IPA ICF

2019-09-19 Thread Alexander Monakov
On Thu, 19 Sep 2019, Richard Biener wrote: > > Good point, there's a tested patch. > > OK. Hold on, is the new comparator really correct? @@ -3384,20 +3372,11 @@ sort_congruence_classes_by_decl_uid (const void *a, const void *b) static int sort_congruence_class_groups_by_decl_uid (const voi

Re: [PATCH] Speed up qsort in IPA ICF

2019-09-19 Thread Richard Biener
On Thu, Sep 19, 2019 at 3:02 PM Martin Liška wrote: > > On 9/19/19 1:01 PM, Richard Biener wrote: > > On Thu, Sep 19, 2019 at 11:06 AM Martin Liška wrote: > >> > >> Hi. > >> > >> As Alexander pointed out, the sort_congruence_class_groups_by_decl_uid is > >> the most > >> expensive qsort operator

Re: [PATCH] Speed up qsort in IPA ICF

2019-09-19 Thread Martin Liška
>> DECL_UID (classes[i]->classes[0]->members[0]->decl). >> * ipa-icf.h (struct congruence_class_group): New field. >> --- >> gcc/ipa-icf.c | 29 +---------------- >> gcc/ipa-icf.h | 1 + >> 2 files changed, 6 in

Re: [PATCH] Speed up qsort in IPA ICF

2019-09-19 Thread Richard Biener
On Thu, Sep 19, 2019 at 11:06 AM Martin Liška wrote: > > Hi. > > As Alexander pointed out, the sort_congruence_class_groups_by_decl_uid is the > most > expensive qsort operator in tramp3d compilation. It does unfortunate 7 > pointer dereferences > via: DECL_UID (classes[i]->classes[0]->members[0

[PATCH] Speed up qsort in IPA ICF

2019-09-19 Thread Martin Liška
Hi. As Alexander pointed out, the sort_congruence_class_groups_by_decl_uid is the most expensive qsort operator in tramp3d compilation. It does unfortunate 7 pointer dereferences via: DECL_UID (classes[i]->classes[0]->members[0]->decl). I'm suggesting to cache that in congruence_class_group. P