• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -safepoint-ir-verifier-print-only -verify-safepoint-ir -S %s 2>&1 | FileCheck %s
2
3define i8 addrspace(1)* @test1(i64 %arg) gc "statepoint-example" {
4; CHECK: No illegal uses found by SafepointIRVerifier in: test1
5entry:
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
8}
9
10define i8 addrspace(1)* @test2(i64 %arg) gc "statepoint-example" {
11; CHECK: No illegal uses found by SafepointIRVerifier in: test2
12entry:
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
16}
17
18define i8 addrspace(1)* @test3(i64 %arg) gc "statepoint-example" {
19; CHECK: No illegal uses found by SafepointIRVerifier in: test3
20entry:
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
25}
26
27define i8 addrspace(1)* @test4(i64 %arg, i1 %cond) gc "statepoint-example" {
28; CHECK: No illegal uses found by SafepointIRVerifier in: test4
29entry:
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
32
33split:
34  %load_addr.2 = getelementptr i8, i8 addrspace(1)* inttoptr (i64 30 to i8 addrspace(1)*), i64 %arg
35  br label %join
36
37join:
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
41}
42
43define i8 addrspace(1)* @test5(i64 %arg, i1 %cond) gc "statepoint-example" {
44; CHECK: No illegal uses found by SafepointIRVerifier in: test5
45entry:
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
51}
52
53define 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!
56entry:
57  %load_addr.1 = getelementptr i8, i8 addrspace(1)* %base, i64 %arg
58  br i1 %cond, label %split, label %join
59
60split:
61  %load_addr.2 = getelementptr i8, i8 addrspace(1)* inttoptr (i64 30 to i8 addrspace(1)*), i64 %arg
62  br label %join
63
64join:
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
68}
69
70declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
71