serge-sans-paille created this revision. serge-sans-paille added reviewers: aaron.ballman, vdelvecc. serge-sans-paille requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
This got removed by 6cacd420a1d72bca7809e6b516fb1e18ac6056c8 <https://reviews.llvm.org/rG6cacd420a1d72bca7809e6b516fb1e18ac6056c8>, and that was a mistake. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D120205 Files: clang/docs/LanguageExtensions.rst Index: clang/docs/LanguageExtensions.rst =================================================================== --- clang/docs/LanguageExtensions.rst +++ clang/docs/LanguageExtensions.rst @@ -2205,6 +2205,39 @@ .. _langext-__builtin_assume: +``__builtin_assume`` +-------------------- + +``__builtin_assume`` is used to provide the optimizer with a boolean +invariant that is defined to be true. + +**Syntax**: + +.. code-block:: c++ + + __builtin_assume(bool) + +**Example of Use**: + +.. code-block:: c++ + + int foo(int x) { + __builtin_assume(x != 0); + // The optimizer may short-circuit this check using the invariant. + if (x == 0) + return do_something(); + return do_something_else(); + } + +**Description**: + +The boolean argument to this function is defined to be true. The optimizer may +analyze the form of the expression provided as the argument and deduce from +that information used to optimize the program. If the condition is violated +during execution, the behavior is undefined. The argument itself is + +Query for this feature with ``__has_builtin(__builtin_assume)``. + ``__builtin_call_with_static_chain`` ------------------------------------
Index: clang/docs/LanguageExtensions.rst =================================================================== --- clang/docs/LanguageExtensions.rst +++ clang/docs/LanguageExtensions.rst @@ -2205,6 +2205,39 @@ .. _langext-__builtin_assume: +``__builtin_assume`` +-------------------- + +``__builtin_assume`` is used to provide the optimizer with a boolean +invariant that is defined to be true. + +**Syntax**: + +.. code-block:: c++ + + __builtin_assume(bool) + +**Example of Use**: + +.. code-block:: c++ + + int foo(int x) { + __builtin_assume(x != 0); + // The optimizer may short-circuit this check using the invariant. + if (x == 0) + return do_something(); + return do_something_else(); + } + +**Description**: + +The boolean argument to this function is defined to be true. The optimizer may +analyze the form of the expression provided as the argument and deduce from +that information used to optimize the program. If the condition is violated +during execution, the behavior is undefined. The argument itself is + +Query for this feature with ``__has_builtin(__builtin_assume)``. + ``__builtin_call_with_static_chain`` ------------------------------------
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits