1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___UTILITY_ASSUME_H
10#define _LIBCPP___UTILITY_ASSUME_H
11
12#include <__config>
13
14#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15# pragma GCC system_header
16#endif
17
18_LIBCPP_PUSH_MACROS
19#include <__undef_macros>
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22
23// WARNING: [[assume]] can currently inhibit optimizations. Only add assumptions with a clear optimization intent.
24// See https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609 for a discussion.
25
26_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 void __assume(bool __cond) { [[__assume__(__cond)]]; }
27
28_LIBCPP_END_NAMESPACE_STD
29
30_LIBCPP_POP_MACROS
31
32#endif // _LIBCPP___UTILITY_ASSUME_H
33