[PATCH] Teach builtin clz, ctz, and popcount to be const

Richard Smith richard at metafoo.co.uk
Wed Jun 12 22:05:26 PDT 2013


On Wed, Jun 12, 2013 at 10:59 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Tue, Jun 11, 2013 at 10:37 PM, <mail at justinbogner.com> wrote:
>>
>> Joerg Sonnenberger <joerg at britannica.bec.de> writes:
>> >> Do you mean something like this?
>> >
>> > Yes, with a few more (non-trivial) test vectors.
>>
>> Here's a version with some more interesting tests. I've also opted to
>> treat __builtin_clz(0) as non-const as per Richard's suggestion.
>
>
> Don't return false from VisitCallExpr without emitting a diagnostic (see the
> comment at the top of the file) -- replace the
>
>   if (!Val)
>     return false;
>
> with
>
>   if (!Val)
>     return Error(E);
>
> Otherwise LGTM, thanks!

Committed with that tweak as r183886.



More information about the cfe-commits mailing list