1 ; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s
2 ; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s
4 ; Ensure that the gc.statepoint calls / invokes we generate carry over
5 ; the right calling conventions.
7 define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality {
8 ; CHECK-LABEL: @test_invoke_format(
10 ; CHECK: invoke coldcc token (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @callee, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0
12 %ret_val = invoke coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
13 to label %normal_return unwind label %exceptional_return
16 ret i64 addrspace(1)* %ret_val
19 %landing_pad4 = landingpad token
21 ret i64 addrspace(1)* %obj1
24 define i64 addrspace(1)* @test_call_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" {
25 ; CHECK-LABEL: @test_call_format(
27 ; CHECK: call coldcc token (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @callee, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0
29 %ret_val = call coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
30 ret i64 addrspace(1)* %ret_val
33 ; This function is inlined when inserting a poll.
34 declare void @do_safepoint()
35 define void @gc.safepoint_poll() {
36 ; CHECK-LABEL: gc.safepoint_poll
38 call void @do_safepoint()
42 declare coldcc i64 addrspace(1)* @callee(i64 addrspace(1)*)
43 declare i32 @personality()