This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH GCC]Introduce qsort_range interface for GCC vector
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Bin Cheng <Bin dot Cheng at arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Tue, 17 Oct 2017 15:00:16 +0200
- Subject: Re: [PATCH GCC]Introduce qsort_range interface for GCC vector
- Authentication-results: sourceware.org; auth=none
- References: <DB5PR0801MB27427080EF52F920D24BF223E74F0@DB5PR0801MB2742.eurprd08.prod.outlook.com>
On Mon, Oct 16, 2017 at 4:53 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> I was asked by Richi to replace insertion sort with qsort_range in loop
> nest distribution patch. Although I believe stable sort (thus insertion)
> sort is needed in that case, I also added qsort_range interface in vec.h.
> The new interface might be useful in other places.
> Bootstrap and test on x86_64 and AArch64 with other patches. Is it OK?
I think you want
gcc_checking_assert (e >= s && e < length ());
if (e - s + 1 > 1)
::qsort (...);
so elide qsort for 1 element and do the validity verification with a
checking assert.
Ok with that change.
Richard.
> Thanks,
> bin
> 2017-10-13 Bin Cheng <bin.cheng@arm.com>
>
> * vec.h (struct GTY((user)) vec<T, A, vl_embed>::qsort_range): New
> member function.
> (struct vec<T, va_heap, vl_ptr>): New member function.