@@ -9547,8 +9547,12 @@ The '``callbr``' instruction causes control to transfer to a specified
9547
9547
function, with the possibility of control flow transfer to either the
9548
9548
'``fallthrough``' label or one of the '``indirect``' labels.
9549
9549
9550
- This instruction should only be used to implement the "goto" feature of gcc
9551
- style inline assembly. Any other usage is an error in the IR verifier.
9550
+ This instruction can currently only be used
9551
+
9552
+ #. to implement the "goto" feature of gcc style inline assembly or
9553
+ #. to call selected intrinsics.
9554
+
9555
+ Any other usage is an error in the IR verifier.
9552
9556
9553
9557
Note that in order to support outputs along indirect edges, LLVM may need to
9554
9558
split critical edges, which may require synthesizing a replacement block for
@@ -9589,7 +9593,8 @@ This instruction requires several arguments:
9589
9593
indicates the function accepts a variable number of arguments, the
9590
9594
extra arguments can be specified.
9591
9595
#. '``fallthrough label``': the label reached when the inline assembly's
9592
- execution exits the bottom.
9596
+ execution exits the bottom. In case of an intrinsic call, the semantic
9597
+ depends on the semantic of the intrinsic.
9593
9598
#. '``indirect labels``': the labels reached when a callee transfers control
9594
9599
to a location other than the '``fallthrough label``'. Label constraints
9595
9600
refer to these destinations.
@@ -9607,9 +9612,12 @@ flow goes after the call.
9607
9612
The output values of a '``callbr``' instruction are available both in the
9608
9613
the '``fallthrough``' block, and any '``indirect``' blocks(s).
9609
9614
9610
- The only use of this today is to implement the "goto" feature of gcc inline
9611
- assembly where additional labels can be provided as locations for the inline
9612
- assembly to jump to.
9615
+ The only uses of this today are:
9616
+
9617
+ #. implement the "goto" feature of gcc inline assembly where additional
9618
+ labels can be provided as locations for the inline assembly to jump to.
9619
+ #. support selected intrinsics which manipulate control flow and should
9620
+ be chained to specific terminators, such as '``unreachable``'.
9613
9621
9614
9622
Example:
9615
9623
""""""""
@@ -9624,6 +9632,14 @@ Example:
9624
9632
<result> = callbr i32 asm "", "=r,r,!i"(i32 %x)
9625
9633
to label %fallthrough [label %indirect]
9626
9634
9635
+ ; intrinsic which should be followed by unreachable (the order of the
9636
+ ; blocks after the callbr instruction doesn't matter)
9637
+ callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill]
9638
+ cont:
9639
+ ...
9640
+ kill:
9641
+ unreachable
9642
+
9627
9643
.. _i_resume:
9628
9644
9629
9645
'``resume``' Instruction
0 commit comments