[llvm] Add llvm.cond.loop intrinsic. (PR #177686)
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 26 10:58:00 PST 2026
================
@@ -32234,3 +32201,49 @@ intrinsics that this intrinsic is lowered into. The intent is that the
deactivation symbol represents a field identifier.
This intrinsic is used to implement structure protection.
+
+'``llvm.cond.loop``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+::
+
+ declare void @llvm.cond.loop(i1 pred)
+
+Overview:
+"""""""""
+
+The '``llvm.cond.loop``' intrinsic spins in an infinite loop if the
+given predicate ``pred`` is true, otherwise it does nothing.
+
+Arguments:
+""""""""""
+
+``pred`` is the predicate.
+
+Semantics:
+""""""""""
+
+This intrinsic is semantically equivalent to a conditional branch
+conditioned on ``pred`` to a basic block consisting only of an
+unconditional branch to itself. Unlike such a branch, it is guaranteed
+to use specific instructions. This allows an interrupt handler or other
----------------
pcc wrote:
We'll need it to be a requirement on specific architectures to support the signal handler use case. As noted in the other comment I'm fine with it not being a requirement on every architecture.
https://github.com/llvm/llvm-project/pull/177686
More information about the llvm-commits
mailing list