1 ; RUN: opt -safepoint-ir-verifier-print-only -verify-safepoint-ir -S %s 2>&1 | FileCheck %s
3 define i8 addrspace(1)* @test1(i64 %arg) gc "statepoint-example" {
4 ; CHECK: No illegal uses found by SafepointIRVerifier in: test1
6 %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
7 ret i8 addrspace(1)* null
10 define i8 addrspace(1)* @test2(i64 %arg) gc "statepoint-example" {
11 ; CHECK: No illegal uses found by SafepointIRVerifier in: test2
13 %load_addr = getelementptr i8, i8 addrspace(1)* inttoptr (i64 15 to i8 addrspace(1)*), i64 %arg
14 %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
15 ret i8 addrspace(1)* %load_addr
18 define i8 addrspace(1)* @test3(i64 %arg) gc "statepoint-example" {
19 ; CHECK: No illegal uses found by SafepointIRVerifier in: test3
21 %load_addr = getelementptr i32, i32 addrspace(1)* inttoptr (i64 15 to i32 addrspace(1)*), i64 %arg
22 %load_addr.cast = bitcast i32 addrspace(1)* %load_addr to i8 addrspace(1)*
23 %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
24 ret i8 addrspace(1)* %load_addr.cast
27 define i8 addrspace(1)* @test4(i64 %arg, i1 %cond) gc "statepoint-example" {
28 ; CHECK: No illegal uses found by SafepointIRVerifier in: test4
30 %load_addr.1 = getelementptr i8, i8 addrspace(1)* inttoptr (i64 15 to i8 addrspace(1)*), i64 %arg
31 br i1 %cond, label %split, label %join
34 %load_addr.2 = getelementptr i8, i8 addrspace(1)* inttoptr (i64 30 to i8 addrspace(1)*), i64 %arg
38 %load_addr = phi i8 addrspace(1)* [%load_addr.1, %entry], [%load_addr.2, %split]
39 %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
40 ret i8 addrspace(1)* %load_addr
43 define i8 addrspace(1)* @test5(i64 %arg, i1 %cond) gc "statepoint-example" {
44 ; CHECK: No illegal uses found by SafepointIRVerifier in: test5
46 %load_addr.1 = getelementptr i8, i8 addrspace(1)* inttoptr (i64 15 to i8 addrspace(1)*), i64 %arg
47 %load_addr.2 = getelementptr i8, i8 addrspace(1)* inttoptr (i64 30 to i8 addrspace(1)*), i64 %arg
48 %load_addr = select i1 %cond, i8 addrspace(1)* %load_addr.1, i8 addrspace(1)* %load_addr.2
49 %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
50 ret i8 addrspace(1)* %load_addr
53 define i8 addrspace(1)* @test6(i64 %arg, i1 %cond, i8 addrspace(1)* %base) gc "statepoint-example" {
54 ; CHECK-LABEL: Verifying gc pointers in function: test6
55 ; CHECK: Illegal use of unrelocated value found!
57 %load_addr.1 = getelementptr i8, i8 addrspace(1)* %base, i64 %arg
58 br i1 %cond, label %split, label %join
61 %load_addr.2 = getelementptr i8, i8 addrspace(1)* inttoptr (i64 30 to i8 addrspace(1)*), i64 %arg
65 %load_addr = phi i8 addrspace(1)* [%load_addr.1, %entry], [%load_addr.2, %split]
66 %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* undef, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
67 ret i8 addrspace(1)* %load_addr
70 declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)