This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Alexander Monakov <amonakov at ispras dot ru>
- Cc: Michael Matz <matz at suse dot de>, Jan Hubicka <hubicka at ucw dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 3 Sep 2018 13:52:48 +0200
- Subject: Re: [PATCH 4/4] bb-reorder: convert to gcc_stablesort
- References: <alpine.LNX.2.20.13.1808281157510.10521@monopod.intra.ispras.ru> <alpine.LNX.2.20.13.1808281203511.10521@monopod.intra.ispras.ru> <alpine.LNX.2.20.13.1808281217480.10521@monopod.intra.ispras.ru> <CAFiYyc0yA-xck_PiiN-xxhxfR1AYh3SS0Ev9QyaJD8=Z6p7mHw@mail.gmail.com> <alpine.LNX.2.20.13.1808281826130.10521@monopod.intra.ispras.ru> <alpine.LSU.2.21.1808281941400.7867@wotan.suse.de> <alpine.LNX.2.20.13.1808291701480.10521@monopod.intra.ispras.ru> <alpine.LNX.2.20.13.1809031409080.23330@monopod.intra.ispras.ru>
On Mon, Sep 3, 2018 at 1:17 PM Alexander Monakov <amonakov@ispras.ru> 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 if counts are equal, -1 if E1 has the larger count. */
> > > > return (m == c2) - (m == c1);
> > > >
> > > > Or, alternatively, employ more branchy checks:
> > > >
> > > > if (c1 == c2)
> > > > return 0;
> > > > if (c1 == c1.max (c2))
> > > > return -1;
> > > > return 1;
> > >
> > > You want to at least comment on why a tradition </>/== check isn't
> > > working, namely because of the uninitialized counts.
> >
> > Alright, so how about this comment:
> >
> > /* Using 'max', as profile_count::operator< does not establish
> > a strict weak order when uninitialized counts may be present. */
> > profile_count m = c1.max (c2);
> > return (m == c2) - (m == c1);
This variant works for me if you clarify that max () makes uninitialized
counts less.
> > Or the same comment in the "branchy" alternative.
>
> Ping, would any of proposed variants clarify the situation, and were there
> any other issues with the patch?
OK with the above variant.
Richard.
> Thanks.
> Alexander