Move the personality function from LandingPadInst to Function
[oota-llvm.git] / test / Transforms / PlaceSafepoints / statepoint-format.ll
1 ; RUN: opt -place-safepoints -S < %s | FileCheck %s
2
3 ; Ensure that the gc.statepoint calls / invokes we generate have the
4 ; set of arguments we expect it to have.
5
6 define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality {
7 ; CHECK-LABEL: @test_invoke_format(
8 ; CHECK-LABEL: entry:
9 ; CHECK: invoke i32 (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)
10 entry:
11   %ret_val = invoke i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
12                to label %normal_return unwind label %exceptional_return
13
14 normal_return:
15   ret i64 addrspace(1)* %ret_val
16
17 exceptional_return:
18   %landing_pad4 = landingpad {i8*, i32}
19           cleanup
20   ret i64 addrspace(1)* %obj1
21 }
22
23 define 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:
26 ; CHECK: call i32 (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)
27 entry:
28   %ret_val = call 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.
33 declare void @do_safepoint()
34 define void @gc.safepoint_poll() {
35 ; CHECK-LABEL: gc.safepoint_poll
36 entry:
37   call void @do_safepoint()
38   ret void
39 }
40
41 declare i64 addrspace(1)* @callee(i64 addrspace(1)*)
42 declare i32 @personality()