1; RUN: opt %s -safepoint-ir-verifier-print-only -verify-safepoint-ir -S 2>&1 | FileCheck %s
2
3; CHECK:      Illegal use of unrelocated value found!
4; CHECK-NEXT: Def:   %base_phi4 = phi %jObject addrspace(1)* addrspace(1)* [ %addr98.relocated, %not_zero146 ], [ %cast6, %bci_37-aload ], !is_base_value !0
5; CHECK-NEXT: Use:   %safepoint_token = tail call token (i64, i32, i32 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i32f(i64 0, i32 0, i32 ()* undef, i32 0, i32 0, i32 0, i32 0) [ "gc-live"(%jObject addrspace(1)* %base_phi1, %jObject addrspace(1)* addrspace(1)* %base_phi4, %jObject addrspace(1)* addrspace(1)* %relocated4, %jObject addrspace(1)* %relocated7) ]
6
7
8%jObject = type { [8 x i8] }
9
10declare %jObject addrspace(1)* @generate_obj1() #1
11
12declare %jObject addrspace(1)* addrspace(1)* @generate_obj2() #1
13
14declare %jObject addrspace(1)* @generate_obj3() #1
15
16; Function Attrs: nounwind
17define  void @test(%jObject addrspace(1)*, %jObject addrspace(1)*, i32) #3 gc "statepoint-example" {
18bci_0:
19  %result608 = call %jObject addrspace(1)* @generate_obj3()
20  %obj609 = bitcast %jObject addrspace(1)* %result608 to %jObject addrspace(1)*
21  %cast = bitcast %jObject addrspace(1)* %result608 to %jObject addrspace(1)*
22  %cast5 = bitcast %jObject addrspace(1)* %result608 to %jObject addrspace(1)*
23  br label %bci_37-aload
24
25bci_37-aload:                                     ; preds = %not_zero179, %bci_0
26  %base_phi = phi %jObject addrspace(1)* [ %base_phi1.relocated, %not_zero179 ], [ %cast, %bci_0 ], !is_base_value !0
27  %base_phi2 = phi %jObject addrspace(1)* [ %base_phi3, %not_zero179 ], [ %cast5, %bci_0 ], !is_base_value !0
28  %relocated8 = phi %jObject addrspace(1)* [ %relocated7.relocated, %not_zero179 ], [ %obj609, %bci_0 ]
29  %tmp3 = getelementptr inbounds %jObject, %jObject addrspace(1)* %relocated8, i64 0, i32 0, i64 32
30  %addr98 = bitcast i8 addrspace(1)* %tmp3 to %jObject addrspace(1)* addrspace(1)*
31  %cast6 = bitcast %jObject addrspace(1)* %base_phi2 to %jObject addrspace(1)* addrspace(1)*
32  br i1 undef, label %not_zero179, label %not_zero146
33
34not_zero146:                                      ; preds = %bci_37-aload
35  %addr98.relocated = call %jObject addrspace(1)* addrspace(1)* @generate_obj2() #1
36  %obj609.relocated = call %jObject addrspace(1)* @generate_obj1() #1
37  br label %not_zero179
38
39not_zero179:                                      ; preds = %not_zero146, %bci_37-aload
40  %base_phi1 = phi %jObject addrspace(1)* [ %obj609.relocated, %not_zero146 ], [ %base_phi, %bci_37-aload ], !is_base_value !0
41  %base_phi3 = phi %jObject addrspace(1)* [ %obj609.relocated, %not_zero146 ], [ %base_phi2, %bci_37-aload ], !is_base_value !0
42  %relocated7 = phi %jObject addrspace(1)* [ %obj609.relocated, %not_zero146 ], [ %relocated8, %bci_37-aload ]
43  %base_phi4 = phi %jObject addrspace(1)* addrspace(1)* [ %addr98.relocated, %not_zero146 ], [ %cast6, %bci_37-aload ], !is_base_value !0
44  %relocated4 = phi %jObject addrspace(1)* addrspace(1)* [ %addr98.relocated, %not_zero146 ], [ %addr98, %bci_37-aload ]
45  %safepoint_token = tail call  token (i64, i32, i32 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i32f(i64 0, i32 0, i32 ()* undef, i32 0, i32 0, i32 0, i32 0) ["gc-live"(%jObject addrspace(1)* %base_phi1, %jObject addrspace(1)* addrspace(1)* %base_phi4, %jObject addrspace(1)* addrspace(1)* %relocated4, %jObject addrspace(1)* %relocated7)]
46  %tmp4 = call i32 @llvm.experimental.gc.result.i32(token %safepoint_token)
47  %base_phi1.relocated = call coldcc %jObject addrspace(1)* @llvm.experimental.gc.relocate.p1jObject(token %safepoint_token, i32 0, i32 0)
48  %base_phi4.relocated = call coldcc %jObject addrspace(1)* addrspace(1)* @llvm.experimental.gc.relocate.p1p1jObject(token %safepoint_token, i32 1, i32 1)
49  %relocated4.relocated = call coldcc %jObject addrspace(1)* addrspace(1)* @llvm.experimental.gc.relocate.p1p1jObject(token %safepoint_token, i32 1, i32 2)
50  %relocated7.relocated = call coldcc %jObject addrspace(1)* @llvm.experimental.gc.relocate.p1jObject(token %safepoint_token, i32 0, i32 3)
51  %addr636 = bitcast %jObject addrspace(1)* addrspace(1)* %relocated4.relocated to %jObject addrspace(1)* addrspace(1)*
52  br label %bci_37-aload
53}
54
55declare token @llvm.experimental.gc.statepoint.p0f_i32f(i64, i32, i32 ()*, i32, i32, ...)
56
57; Function Attrs: nounwind
58declare i32 @llvm.experimental.gc.result.i32(token) #4
59
60; Function Attrs: nounwind
61declare %jObject addrspace(1)* @llvm.experimental.gc.relocate.p1jObject(token, i32, i32) #4
62
63; Function Attrs: nounwind
64declare %jObject addrspace(1)* addrspace(1)* @llvm.experimental.gc.relocate.p1p1jObject(token, i32, i32) #4
65
66attributes #0 = { noinline nounwind "gc-leaf-function"="true" }
67attributes #1 = { "gc-leaf-function"="true" }
68attributes #2 = { nounwind readonly "gc-leaf-function"="true" }
69attributes #3 = { nounwind }
70attributes #4 = { nounwind }
71
72!0 = !{i32 1}
73