1 ; RUN: not opt -S %s -verify 2>&1 | FileCheck %s
3 ; CHECK: Indirect label missing from arglist.
6 ; The %4 in the indirect label list is not found in the blockaddresses in the
8 callbr void asm sideeffect "#test1", "i,i"(i8* blockaddress(@test1, %3), i8* blockaddress(@test1, %2))
9 to label %1 [label %4, label %2]
20 ; CHECK-NOT: Indirect label missing from arglist.
21 define void @test2() {
22 ; %4 and %2 are both in the indirect label list and the arg list (good).
23 callbr void asm sideeffect "${0:l} ${1:l}", "i,i"(i8* blockaddress(@test2, %4), i8* blockaddress(@test2, %2))
24 to label %1 [label %4, label %2]
35 ; CHECK-NOT: Indirect label missing from arglist.
36 define void @test3() {
37 ; note %2 blockaddress. Such a case is possible when passing the address of
38 ; a label as an input to the inline asm (both address of label and asm goto
39 ; use blockaddress constants; we're testing that the indirect label list from
40 ; the asm goto is in the arg list to the asm).
41 callbr void asm sideeffect "${0:l} ${1:l} ${2:l}", "i,X,i"(i8* blockaddress(@test3, %4), i8* blockaddress(@test3, %2), i8* blockaddress(@test3, %3))
42 to label %1 [label %3, label %4]
53 ;; Ensure you cannot use the return value of a callbr in indirect targets.
54 ; CHECK: Instruction does not dominate all uses!
56 define i32 @test4(i1 %var) {
58 %ret = callbr i32 asm sideeffect "#test4", "=r,i"(i8* blockaddress(@test4, %abnormal)) to label %normal [label %abnormal]
67 ;; Ensure you cannot specify the same label as both normal and indirect targets.
68 ; CHECK: Duplicate callbr destination!
72 %ret = callbr i32 asm sideeffect "#test5", "=r,i"(i8* blockaddress(@test5, %both)) to label %both [label %both]