1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s 2>&1 | FileCheck %s
4 target triple = "x86_64-pc-linux-gnu"
6 declare void @"some_call"(i64 addrspace(1)*)
7 declare i64 addrspace(1)* @"some_other_call"(i64 addrspace(1)*)
9 declare i32 @"personality_function"()
11 define i64 addrspace(1)* @test_basic(i64 addrspace(1)* %obj,
12 i64 addrspace(1)* %obj1)
13 gc "statepoint-example" personality i32 ()* @"personality_function" {
15 %0 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0) ["gc-live" (i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1), "deopt" (i32 0, i32 -1, i32 0, i32 0, i32 0)]
16 to label %invoke_safepoint_normal_dest unwind label %exceptional_return
18 invoke_safepoint_normal_dest:
19 %obj.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 0, i32 0)
20 %obj1.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 1, i32 1)
21 br label %normal_return
24 ret i64 addrspace(1)* %obj.relocated
27 %landing_pad = landingpad token
29 %obj.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 0, i32 0)
30 %obj1.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 1, i32 1)
31 ret i64 addrspace(1)* %obj1.relocated1
33 ; CHECK-LABEL: GCC_except_table{{[0-9]+}}:
34 ; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}}
35 ; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}}
39 define i64 addrspace(1)* @test_result(i64 addrspace(1)* %obj,
40 i64 addrspace(1)* %obj1)
41 gc "statepoint-example" personality i32 ()* @personality_function {
43 %0 = invoke token (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 0, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @some_other_call, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0) ["gc-live"(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1)]
44 to label %normal_return unwind label %exceptional_return
47 %ret_val = call i64 addrspace(1)* @llvm.experimental.gc.result.p1i64(token %0)
48 ret i64 addrspace(1)* %ret_val
51 %landing_pad = landingpad token
53 %obj.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 0, i32 0)
54 ret i64 addrspace(1)* %obj.relocated
56 ; CHECK-LABEL: GCC_except_table{{[0-9]+}}:
57 ; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}}
58 ; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}}
62 define i64 addrspace(1)* @test_same_val(i1 %cond, i64 addrspace(1)* %val1, i64 addrspace(1)* %val2, i64 addrspace(1)* %val3)
63 gc "statepoint-example" personality i32 ()* @"personality_function" {
65 br i1 %cond, label %left, label %right
68 %sp1 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 0) ["gc-live"(i64 addrspace(1)* %val1, i64 addrspace(1)* %val2)]
69 to label %left.relocs unwind label %exceptional_return.left
72 %val1.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 0, i32 0)
73 %val2.relocated_left = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 1, i32 1)
74 br label %normal_return
77 %sp2 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 0) ["gc-live"(i64 addrspace(1)* %val2, i64 addrspace(1)* %val3)]
78 to label %right.relocs unwind label %exceptional_return.right
81 %val2.relocated_right = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp2, i32 0, i32 0)
82 %val3.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp2, i32 1, i32 1)
83 br label %normal_return
86 %a1 = phi i64 addrspace(1)* [%val1.relocated, %left.relocs], [%val3.relocated, %right.relocs]
87 %a2 = phi i64 addrspace(1)* [%val2.relocated_left, %left.relocs], [%val2.relocated_right, %right.relocs]
88 %ret = select i1 %cond, i64 addrspace(1)* %a1, i64 addrspace(1)* %a2
89 ret i64 addrspace(1)* %ret
91 exceptional_return.left:
92 %landing_pad = landingpad token
94 %val.relocated2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 0, i32 0)
95 ret i64 addrspace(1)* %val.relocated2
97 exceptional_return.right:
98 %landing_pad1 = landingpad token
100 %val.relocated3 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad1, i32 0, i32 0)
101 ret i64 addrspace(1)* %val.relocated3
104 define i64 addrspace(1)* @test_null_undef(i64 addrspace(1)* %val1)
105 gc "statepoint-example" personality i32 ()* @"personality_function" {
107 %sp1 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 0) ["gc-live"(i64 addrspace(1)* null, i64 addrspace(1)* undef)]
108 to label %normal_return unwind label %exceptional_return
111 %null.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 0, i32 0)
112 %undef.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 1, i32 1)
113 ret i64 addrspace(1)* %null.relocated
116 %landing_pad = landingpad token
118 %null.relocated2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 0, i32 0)
119 %undef.relocated2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 1, i32 1)
120 ret i64 addrspace(1)* %null.relocated2
123 define i64 addrspace(1)* @test_alloca_and_const(i64 addrspace(1)* %val1)
124 gc "statepoint-example" personality i32 ()* @"personality_function" {
127 %aa = addrspacecast i32* %a to i32 addrspace(1)*
128 %c = inttoptr i64 15 to i64 addrspace(1)*
129 %sp = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 0) ["gc-live"(i32 addrspace(1)* %aa, i64 addrspace(1)* %c)]
130 to label %normal_return unwind label %exceptional_return
133 %aa.rel = call coldcc i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %sp, i32 0, i32 0)
134 %aa.converted = bitcast i32 addrspace(1)* %aa.rel to i64 addrspace(1)*
135 ret i64 addrspace(1)* %aa.converted
138 %landing_pad = landingpad token
140 %aa.rel2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 1, i32 1)
141 ret i64 addrspace(1)* %aa.rel2
144 declare token @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...)
145 declare token @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...)
147 declare i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token, i32, i32)
148 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
149 declare i64 addrspace(1)* @llvm.experimental.gc.result.p1i64(token)