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"(ptr addrspace(1))
7 declare ptr addrspace(1) @"some_other_call"(ptr addrspace(1))
9 declare i32 @"personality_function"()
11 define ptr addrspace(1) @test_basic(ptr addrspace(1) %obj,
12 ptr addrspace(1) %obj1)
13 gc "statepoint-example" personality ptr @"personality_function" {
15 %0 = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (ptr addrspace(1))) @some_call, i32 1, i32 0, ptr addrspace(1) %obj, i32 0, i32 0) ["gc-live" (ptr addrspace(1) %obj, ptr 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 ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %0, i32 0, i32 0)
20 %obj1.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %0, i32 1, i32 1)
21 br label %normal_return
24 ret ptr addrspace(1) %obj.relocated
27 %landing_pad = landingpad token
29 %obj.relocated1 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 0, i32 0)
30 %obj1.relocated1 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 1, i32 1)
31 ret ptr 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 ptr addrspace(1) @test_result(ptr addrspace(1) %obj,
40 ptr addrspace(1) %obj1)
41 gc "statepoint-example" personality ptr @personality_function {
43 %0 = invoke token (i64, i32, ptr addrspace(1) (ptr addrspace(1))*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr addrspace(1) (ptr addrspace(1))* elementtype(ptr addrspace(1) (ptr addrspace(1))) @some_other_call, i32 1, i32 0, ptr addrspace(1) %obj, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %obj, ptr addrspace(1) %obj1)]
44 to label %normal_return unwind label %exceptional_return
47 %ret_val = call ptr addrspace(1) @llvm.experimental.gc.result.p1(token %0)
48 ret ptr addrspace(1) %ret_val
51 %landing_pad = landingpad token
53 %obj.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 0, i32 0)
54 ret ptr 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 ptr addrspace(1) @test_same_val(i1 %cond, ptr addrspace(1) %val1, ptr addrspace(1) %val2, ptr addrspace(1) %val3)
63 gc "statepoint-example" personality ptr @"personality_function" {
65 br i1 %cond, label %left, label %right
68 %sp1 = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (ptr addrspace(1))) @some_call, i32 1, i32 0, ptr addrspace(1) %val1, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %val1, ptr addrspace(1) %val2)]
69 to label %left.relocs unwind label %exceptional_return.left
72 %val1.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %sp1, i32 0, i32 0)
73 %val2.relocated_left = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %sp1, i32 1, i32 1)
74 br label %normal_return
77 %sp2 = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (ptr addrspace(1))) @some_call, i32 1, i32 0, ptr addrspace(1) %val1, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %val2, ptr addrspace(1) %val3)]
78 to label %right.relocs unwind label %exceptional_return.right
81 %val2.relocated_right = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %sp2, i32 0, i32 0)
82 %val3.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %sp2, i32 1, i32 1)
83 br label %normal_return
86 %a1 = phi ptr addrspace(1) [%val1.relocated, %left.relocs], [%val3.relocated, %right.relocs]
87 %a2 = phi ptr addrspace(1) [%val2.relocated_left, %left.relocs], [%val2.relocated_right, %right.relocs]
88 %ret = select i1 %cond, ptr addrspace(1) %a1, ptr addrspace(1) %a2
89 ret ptr addrspace(1) %ret
91 exceptional_return.left:
92 %landing_pad = landingpad token
94 %val.relocated2 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 0, i32 0)
95 ret ptr addrspace(1) %val.relocated2
97 exceptional_return.right:
98 %landing_pad1 = landingpad token
100 %val.relocated3 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad1, i32 0, i32 0)
101 ret ptr addrspace(1) %val.relocated3
104 define ptr addrspace(1) @test_null_undef(ptr addrspace(1) %val1)
105 gc "statepoint-example" personality ptr @"personality_function" {
107 %sp1 = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (ptr addrspace(1))) @some_call, i32 1, i32 0, ptr addrspace(1) %val1, i32 0, i32 0) ["gc-live"(ptr addrspace(1) null, ptr addrspace(1) undef)]
108 to label %normal_return unwind label %exceptional_return
111 %null.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %sp1, i32 0, i32 0)
112 %undef.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %sp1, i32 1, i32 1)
113 ret ptr addrspace(1) %null.relocated
116 %landing_pad = landingpad token
118 %null.relocated2 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 0, i32 0)
119 %undef.relocated2 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 1, i32 1)
120 ret ptr addrspace(1) %null.relocated2
123 define ptr addrspace(1) @test_alloca_and_const(ptr addrspace(1) %val1)
124 gc "statepoint-example" personality ptr @"personality_function" {
127 %aa = addrspacecast ptr %a to ptr addrspace(1)
128 %c = inttoptr i64 15 to ptr addrspace(1)
129 %sp = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (ptr addrspace(1))) @some_call, i32 1, i32 0, ptr addrspace(1) %val1, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %aa, ptr addrspace(1) %c)]
130 to label %normal_return unwind label %exceptional_return
133 %aa.rel = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %sp, i32 0, i32 0)
134 ret ptr addrspace(1) %aa.rel
137 %landing_pad = landingpad token
139 %aa.rel2 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 1, i32 1)
140 ret ptr addrspace(1) %aa.rel2
143 declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
145 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32, i32)
146 declare ptr addrspace(1) @llvm.experimental.gc.result.p1(token)