diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-03-31 00:18:46 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-03-31 00:18:46 +0000 |
| commit | 021de058df7ff14b279e434e1fbea4b468a47cd5 (patch) | |
| tree | b46f67f86c22331a30b9674d835df29d6d45045b /llvm/docs | |
| parent | 21d3bffe299ddb505cd9ae4f78fbdf92d61477c7 (diff) | |
| download | bcm5719-llvm-021de058df7ff14b279e434e1fbea4b468a47cd5.tar.gz bcm5719-llvm-021de058df7ff14b279e434e1fbea4b468a47cd5.zip | |
Introduce a @llvm.experimental.guard intrinsic
Summary:
As discussed on llvm-dev[1].
This change adds the basic boilerplate code around having this intrinsic
in LLVM:
- Changes in Intrinsics.td, and the IR Verifier
- A lowering pass to lower @llvm.experimental.guard to normal
control flow
- Inliner support
[1]: http://lists.llvm.org/pipermail/llvm-dev/2016-February/095523.html
Reviewers: reames, atrick, chandlerc, rnk, JosephTremoulet, echristo
Subscribers: mcrosier, llvm-commits
Differential Revision: http://reviews.llvm.org/D18527
llvm-svn: 264976
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/LangRef.rst | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index c5704b649fb..23bef902898 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -12181,6 +12181,50 @@ ensure that this symbol is defined). The call arguments to arguments of the specified types, and not as varargs. +'``llvm.experimental.guard``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +:: + + declare void @llvm.experimental.guard(i1, ...) [ "deopt"(...) ] + +Overview: +""""""""" + +This intrinsic, together with :ref:`deoptimization operand bundles +<deopt_opbundles>`, allows frontends to express guards or checks on +optimistic assumptions made during compilation. The semantics of +``@llvm.experimental.guard`` is defined in terms of +``@llvm.experimental.deoptimize`` -- its body is defined to be +equivalent to: + +.. code-block:: llvm + + define void @llvm.experimental.guard(i1 %pred, <args...>) { + %realPred = and i1 %pred, undef + br i1 %realPred, label %continue, label %leave + + leave: + call void @llvm.experimental.deoptimize(<args...>) [ "deopt"() ] + ret void + + continue: + ret void + } + +In words, ``@llvm.experimental.guard`` executes the attached +``"deopt"`` continuation if (but **not** only if) its first argument +is ``false``. Since the optimizer is allowed to replace the ``undef`` +with an arbitrary value, it can optimize guard to fail "spuriously", +i.e. without the original condition being false (hence the "not only +if"); and this allows for "check widening" type optimizations. + +``@llvm.experimental.guard`` cannot be invoked. + + Stack Map Intrinsics -------------------- |

