This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 5/5] Remove const attribute on get_log2
- From: Richard Henderson <rth at twiddle dot net>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Florian Weimer <fweimer at redhat dot com>, Peter Collingbourne <pcc at google dot com>, libc-alpha at sourceware dot org
- Date: Wed, 15 May 2013 14:29:10 -0700
- Subject: Re: [PATCH 5/5] Remove const attribute on get_log2
- References: <1368459372-2415-1-git-send-email-pcc at google dot com> <1368459372-2415-6-git-send-email-pcc at google dot com> <519114FF dot 9030501 at twiddle dot net> <CAMn1gO5AM73ZhN7rO6UnFPG9R4fmW34uhsqmAZb-E175JUBAbg at mail dot gmail dot com> <51933CEE dot 3060901 at redhat dot com> <mvmfvxoy948 dot fsf at hawking dot suse dot de> <5193A20C dot 1010306 at twiddle dot net>
On 05/15/2013 07:56 AM, Richard Henderson wrote:
> On 05/15/2013 12:50 AM, Andreas Schwab wrote:
>> Florian Weimer <fweimer@redhat.com> writes:
>>
>>> I think that at one point, it was fully acceptable to label functions
>>> which perform memoization as "const".
>>
>> I think that's what pure is for.
>
> No, "pure" is for functions that only read from memory, but don't write.
> So if we're talking about the letter of the law, memoization isn't allowed
> there either.
>
> I don't like that LLVM's optimization breaks with such long standing usage of
> the attribute, and I will claim that it's a bug.
>
> That said, get_log2 is used in exactly one place in math/atest-exp2.c, and it's
> a place that's not going to be helped by the const attribute at all. I'm ok
> with removing the attribute in this case.
>
> Much more useful would be figuring out a way to store the log2/exp1/exp_m1
> values as mp_limb_t's rather than strings. Then we have no runtime
> initialization at all.
I've pushed patch 5/5 to master as well.
r~