Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort

2018-09-03 Thread Richard Biener
On Mon, Sep 3, 2018 at 1:17 PM Alexander Monakov wrote: > > On Wed, 29 Aug 2018, Alexander Monakov wrote: > > On Tue, 28 Aug 2018, Michael Matz wrote: > > > > I think it's not too complicated, but how about adding this comment: > > > > > > > > profile_count m = c1.max (c2); > > > > /* Return 0

Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort

2018-09-03 Thread Alexander Monakov
On Wed, 29 Aug 2018, Alexander Monakov wrote: > On Tue, 28 Aug 2018, Michael Matz wrote: > > > I think it's not too complicated, but how about adding this comment: > > > > > > profile_count m = c1.max (c2); > > > /* Return 0 if counts are equal, -1 if E1 has the larger count. */ > > > retur

Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort

2018-08-29 Thread Alexander Monakov
On Tue, 28 Aug 2018, Michael Matz wrote: > > I think it's not too complicated, but how about adding this comment: > > > > profile_count m = c1.max (c2); > > /* Return 0 if counts are equal, -1 if E1 has the larger count. */ > > return (m == c2) - (m == c1); > > > > Or, alternatively, emplo

Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort

2018-08-28 Thread Michael Matz
Hi, On Tue, 28 Aug 2018, Alexander Monakov wrote: > > I think your proposed one > > warrants some comments. Maybe trade speed for some clearer code? > > I think it's not too complicated, but how about adding this comment: > > profile_count m = c1.max (c2); > /* Return 0 if counts are equal

Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort

2018-08-28 Thread Alexander Monakov
On Tue, 28 Aug 2018, Richard Biener wrote: > On Tue, Aug 28, 2018 at 11:22 AM Alexander Monakov wrote: > > > > This converts the use in bb-reorder. I had to get a little bit creative > > with > > the comparator as profile_count::operator> does not implement a strict weak > > order. > > So the

Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort

2018-08-28 Thread Richard Biener
On Tue, Aug 28, 2018 at 11:22 AM Alexander Monakov wrote: > > This converts the use in bb-reorder. I had to get a little bit creative with > the comparator as profile_count::operator> does not implement a strict weak > order. So the previously used comparator was invalid? I think your proposed

Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort

2018-08-28 Thread Alexander Monakov
This converts the use in bb-reorder. I had to get a little bit creative with the comparator as profile_count::operator> does not implement a strict weak order. * gcc/bb-reorder.c (edge_order): Convert to C-qsort-style tri-state comparator. (reorder_basic_blocks_simple): Ch