@@ -9585,8 +9585,12 @@ The '``callbr``' instruction causes control to transfer to a specified
9585
9585
function, with the possibility of control flow transfer to either the
9586
9586
'``fallthrough``' label or one of the '``indirect``' labels.
9587
9587
9588
- This instruction should only be used to implement the "goto" feature of gcc
9589
- style inline assembly. Any other usage is an error in the IR verifier.
9588
+ This instruction can currently only be used
9589
+
9590
+ #. to implement the "goto" feature of gcc style inline assembly or
9591
+ #. to call selected intrinsics.
9592
+
9593
+ Any other usage is an error in the IR verifier.
9590
9594
9591
9595
Note that in order to support outputs along indirect edges, LLVM may need to
9592
9596
split critical edges, which may require synthesizing a replacement block for
@@ -9627,7 +9631,8 @@ This instruction requires several arguments:
9627
9631
indicates the function accepts a variable number of arguments, the
9628
9632
extra arguments can be specified.
9629
9633
#. '``fallthrough label``': the label reached when the inline assembly's
9630
- execution exits the bottom.
9634
+ execution exits the bottom. In case of an intrinsic call, the semantic
9635
+ depends on the semantic of the intrinsic.
9631
9636
#. '``indirect labels``': the labels reached when a callee transfers control
9632
9637
to a location other than the '``fallthrough label``'. Label constraints
9633
9638
refer to these destinations.
@@ -9645,9 +9650,12 @@ flow goes after the call.
9645
9650
The output values of a '``callbr``' instruction are available both in the
9646
9651
the '``fallthrough``' block, and any '``indirect``' blocks(s).
9647
9652
9648
- The only use of this today is to implement the "goto" feature of gcc inline
9649
- assembly where additional labels can be provided as locations for the inline
9650
- assembly to jump to.
9653
+ The only uses of this today are:
9654
+
9655
+ #. implement the "goto" feature of gcc inline assembly where additional
9656
+ labels can be provided as locations for the inline assembly to jump to.
9657
+ #. support selected intrinsics which manipulate control flow and should
9658
+ be chained to specific terminators, such as '``unreachable``'.
9651
9659
9652
9660
Example:
9653
9661
""""""""
@@ -9662,6 +9670,14 @@ Example:
9662
9670
<result> = callbr i32 asm "", "=r,r,!i"(i32 %x)
9663
9671
to label %fallthrough [label %indirect]
9664
9672
9673
+ ; intrinsic which should be followed by unreachable (the order of the
9674
+ ; blocks after the callbr instruction doesn't matter)
9675
+ callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill]
9676
+ cont:
9677
+ ...
9678
+ kill:
9679
+ unreachable
9680
+
9665
9681
.. _i_resume:
9666
9682
9667
9683
'``resume``' Instruction
0 commit comments