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

Richard Smith richard at metafoo.co.uk
Wed Jun 12 10:59:20 PDT 2013


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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130612/e635b732/attachment.html>


More information about the cfe-commits mailing list