Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame^] | 1 | ; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s |
| 2 | ; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s |
| 3 | |
| 4 | ; Ensure that the gc.statepoint calls / invokes we generate carry over |
| 5 | ; the right calling conventions. |
| 6 | |
| 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( |
| 9 | ; CHECK-LABEL: entry: |
| 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 |
| 11 | entry: |
| 12 | %ret_val = invoke coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj) |
| 13 | to label %normal_return unwind label %exceptional_return |
| 14 | |
| 15 | normal_return: |
| 16 | ret i64 addrspace(1)* %ret_val |
| 17 | |
| 18 | exceptional_return: |
| 19 | %landing_pad4 = landingpad token |
| 20 | cleanup |
| 21 | ret i64 addrspace(1)* %obj1 |
| 22 | } |
| 23 | |
| 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( |
| 26 | ; CHECK-LABEL: entry: |
| 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 |
| 28 | entry: |
| 29 | %ret_val = call coldcc i64 addrspace(1)* @callee(i64 addrspace(1)* %obj) |
| 30 | ret i64 addrspace(1)* %ret_val |
| 31 | } |
| 32 | |
| 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 |
| 37 | entry: |
| 38 | call void @do_safepoint() |
| 39 | ret void |
| 40 | } |
| 41 | |
| 42 | declare coldcc i64 addrspace(1)* @callee(i64 addrspace(1)*) |
| 43 | declare i32 @personality() |