@@ -3540,7 +3540,7 @@ the debugging experience.
3540
3540
``__builtin_allow_runtime_check ``
3541
3541
---------------------------------
3542
3542
3543
- ``__builtin_allow_runtime_check `` return true if the check at the current
3543
+ ``__builtin_allow_runtime_check `` returns true if the check at the current
3544
3544
program location should be executed. It is expected to be used to implement
3545
3545
``assert `` like checks which can be safely removed by optimizer.
3546
3546
@@ -3560,28 +3560,25 @@ program location should be executed. It is expected to be used to implement
3560
3560
3561
3561
**Description **
3562
3562
3563
- ``__builtin_allow_runtime_check `` is lowered to ` `` llvm.allow.runtime.check ``
3563
+ ``__builtin_allow_runtime_check `` is lowered to the ` llvm.allow.runtime.check
3564
3564
<https://llvm.org/docs/LangRef.html#llvm-allow-runtime-check-intrinsic> `_
3565
- builtin.
3566
-
3567
- The ``__builtin_allow_runtime_check() `` is expected to be used with control
3568
- flow conditions such as in ``if `` to guard expensive runtime checks. The
3569
- specific rules for selecting permitted checks can differ and are controlled by
3570
- the compiler options.
3571
-
3572
- Flags to control checks:
3573
- * ``-mllvm -lower-allow-check-percentile-cutoff-hot=N `` where N is PGO hotness
3574
- cutoff in range ``[0, 999999] `` to disallow checks in hot code.
3575
- * ``-mllvm -lower-allow-check-random-rate=P `` where P is number in range
3576
- ``[0.0, 1.0] `` representation probability of keeping a check.
3577
- * If both flags are specified, ``-lower-allow-check-random-rate `` takes
3578
- precedence.
3579
- * If none is specified, ``__builtin_allow_runtime_check `` is lowered as
3580
- ``true ``, allowing all checks.
3581
-
3582
- Parameter ``kind `` is a string literal representing a user selected kind for
3583
- guarded check. It's unused now. It will enable kind-specific lowering in future.
3584
- E.g . a higher hotness cutoff can be used for more expensive kind of check.
3565
+ intrinsic.
3566
+
3567
+ The ``__builtin_allow_runtime_check() `` can be used within constrol structures
3568
+ like ``if `` to guard expensive runtime checks. The return value is determined
3569
+ by the following compiler options and may differ per call site:
3570
+
3571
+ * ``-mllvm -lower-allow-check-percentile-cutoff-hot=N ``: Disable checks in hot
3572
+ code marked by the profile summary with a hotness cutoff in the range
3573
+ ``[0, 999999] `` (a larger N disables more checks).
3574
+ * ``-mllvm -lower-allow-check-random-rate=P ``: Keep a check with probability P,
3575
+ a floating point number in the range ``[0.0, 1.0] ``.
3576
+ * If both options are specified, a check is disabled if either condition is satisfied.
3577
+ * If neither is specified, all checks are allowed.
3578
+
3579
+ Parameter ``kind ``, currently unused, is a string literal specifying the check
3580
+ kind. Future compiler versions may use this to allow for more granular control,
3581
+ such as applying different hotness cutoffs to different check kinds.
3585
3582
3586
3583
Query for this feature with ``__has_builtin(__builtin_allow_runtime_check) ``.
3587
3584
0 commit comments