[libcxx-commits] [PATCH] D122397: [libc++] Use __builtin_expect in _LIBCPP_ASSERT

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 24 11:26:16 PDT 2022


ldionne added a comment.

In D122397#3405618 <https://reviews.llvm.org/D122397#3405618>, @philnik wrote:

> Maybe it would make sense to use `__builtin_assume` if assertions are disabled?

My understanding is that `__builtin_assume(x)` does not evaluate `x` ever at runtime, but the documentation is a little bit light on the details. I think this is a fantastic idea, I'll try it out. If `__builtin_assume` does evaluate `x`, I added a test that should fail in my assertions handler patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122397/new/

https://reviews.llvm.org/D122397



More information about the libcxx-commits mailing list