llvm.org GIT mirror llvm / fa93d0e
[PlaceSafepoints] Fix a bug that came in with rL236672. Transfer the calling convention from the invoke being replaced by PlaceStatepoints to the new invoke to gc.statepoint created. Add a test case that would have caught this issue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237414 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 4 years ago
2 changed file(s) with 44 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
950950 ToReplace->getUnwindDest(), makeArrayRef(CS.arg_begin(), CS.arg_end()),
951951 None, None, "safepoint_token");
952952
953 Invoke->setCallingConv(ToReplace->getCallingConv());
954
953955 // In case if we can handle this set of attributes - set up function
954956 // attributes directly on statepoint and return attributes later for
955957 // gc_result intrinsic.
0 ; RUN: opt -place-safepoints -S < %s | FileCheck %s
1
2 ; Ensure that the gc.statepoint calls / invokes we generate carry over
3 ; the right calling conventions.
4
5 define i64 addrspace(1)* @test_invoke_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" {
6 ; CHECK-LABEL: @test_invoke_format(
7 ; CHECK-LABEL: entry:
8 ; CHECK: invoke coldcc 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)
9 entry:
10 %ret_val = invoke coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
11 to label %normal_return unwind label %exceptional_return
12
13 normal_return:
14 ret i64 addrspace(1)* %ret_val
15
16 exceptional_return:
17 %landing_pad4 = landingpad {i8*, i32} personality i32 ()* @personality
18 cleanup
19 ret i64 addrspace(1)* %obj1
20 }
21
22 define i64 addrspace(1)* @test_call_format(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" {
23 ; CHECK-LABEL: @test_call_format(
24 ; CHECK-LABEL: entry:
25 ; CHECK: call coldcc 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)
26 entry:
27 %ret_val = call coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj)
28 ret i64 addrspace(1)* %ret_val
29 }
30
31 ; This function is inlined when inserting a poll.
32 declare void @do_safepoint()
33 define void @gc.safepoint_poll() {
34 ; CHECK-LABEL: gc.safepoint_poll
35 entry:
36 call void @do_safepoint()
37 ret void
38 }
39
40 declare coldcc i64 addrspace(1)* @callee(i64 addrspace(1)*)
41 declare i32 @personality()