[llvm] [IR] Introduce `llvm.allow.{runtime, ubsan}.check()` (PR #84850)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 20 00:21:39 PDT 2024
================
@@ -27696,6 +27696,125 @@ constant `true`. However it is always correct to replace
it with any other `i1` value. Any pass can
freely do it if it can benefit from non-default lowering.
+'``llvm.allow.ubsan.check``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+::
+
+ declare i1 @llvm.allow.ubsan.check(i8 immarg %kind)
+
+Overview:
+"""""""""
+
+This intrinsic returns ``true`` if and only if the compiler opted to enable the
+ubsan check in the current basic block.
+
+Rules to allow ubsan checks are not part of the intrinsic declaration, and
+controlled by compiler options.
+
+This intrinsic is ubsan specific version of ``@llvm.allow.runtime.check()``.
+
+Arguments:
+""""""""""
+
+An integer describing the kind of ubsan check guarded by the intrinsic.
+
+None.
+
+Semantics:
+""""""""""
+
+The intrinsic ``@llvm.allow.ubsan.check()`` returns either ``true`` or
+``false``, depending on compiler options.
+
+For each evaluation of a call to this intrinsic, the program must be valid and
+correct both if it returns ``true`` and if it returns ``false``.
+
+When used in a branch condition, it allows us to choose between
+two alternative correct solutions for the same problem.
+
+If intrunsic is evaluated as ``true``, program must check ubsan condition, and
----------------
arsenm wrote:
```suggestion
If intrinsic is evaluated as ``true``, program must check ubsan condition, and
```
https://github.com/llvm/llvm-project/pull/84850
More information about the llvm-commits
mailing list