blob: f40ff8f3a7d177f62426715b8b0b860b331f8ccd [file] [log] [blame]
Sanjoy Das04071082016-01-29 00:28:57 +00001; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s
Sanjoy Das2c266142015-05-15 00:26:21 +00002
3; Ensure that the gc.statepoint calls / invokes we generate carry over
4; the right calling conventions.
5
David Majnemer7fddecc2015-06-17 20:52:32 +00006define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality {
Sanjoy Das2c266142015-05-15 00:26:21 +00007; CHECK-LABEL: @test_invoke_format(
8; CHECK-LABEL: entry:
Sanjoy Dasf7302c82016-01-28 21:51:14 +00009; 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
Sanjoy Das2c266142015-05-15 00:26:21 +000010entry:
11 %ret_val = invoke coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
12 to label %normal_return unwind label %exceptional_return
13
14normal_return:
15 ret i64 addrspace(1)* %ret_val
16
17exceptional_return:
Sanjoy Dasf7302c82016-01-28 21:51:14 +000018 %landing_pad4 = landingpad token
Sanjoy Das2c266142015-05-15 00:26:21 +000019 cleanup
20 ret i64 addrspace(1)* %obj1
21}
22
23define i64 addrspace(1)* @test_call_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" {
24; CHECK-LABEL: @test_call_format(
25; CHECK-LABEL: entry:
Sanjoy Dasf7302c82016-01-28 21:51:14 +000026; 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
Sanjoy Das2c266142015-05-15 00:26:21 +000027entry:
28 %ret_val = call coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
29 ret i64 addrspace(1)* %ret_val
30}
31
32; This function is inlined when inserting a poll.
33declare void @do_safepoint()
34define void @gc.safepoint_poll() {
35; CHECK-LABEL: gc.safepoint_poll
36entry:
37 call void @do_safepoint()
38 ret void
39}
40
41declare coldcc i64 addrspace(1)* @callee(i64 addrspace(1)*)
42declare i32 @personality()