[libcxx] Add flag to disable __builtin_assume in _LIBCPP_ASSERT
authorArthur Eubanks <aeubanks@google.com>
Wed, 6 Apr 2022 02:16:39 +0000 (19:16 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 7 Apr 2022 16:00:31 +0000 (09:00 -0700)
commit0a77e633226b5598e426603c03e54d62ed275670
tree935eb293c8a4ecbd98d7f658f68b7bf0bc048532
parent6733590db284ac5ba530cc83e8fde699b44c4863
[libcxx] Add flag to disable __builtin_assume in _LIBCPP_ASSERT

Introduce _LIBCPP_ASSERTIONS_DISABLE_ASSUME which makes _LIBCPP_ASSERT
not call __builtin_assume when _LIBCPP_ENABLE_ASSERTIONS == 0.

Calling __builtin_assume was introduced in D122397.

__builtin_assume is generally supposed to improve optimizations, but can
cause regressions when LLVM has trouble handling the calls to
`llvm.assume()` (see comments in D122397).

Reviewed By: philnik

Differential Revision: https://reviews.llvm.org/D123175
libcxx/include/__assert
libcxx/test/libcxx/assertions/single_expression.sh.cpp