1 ; RUN: opt %s -S -place-safepoints | FileCheck %s
4 ; Do we insert a simple entry safepoint?
5 define void @test_entry() gc "statepoint-example" {
6 ; CHECK-LABEL: @test_entry
13 ; On a non-gc function, we should NOT get an entry safepoint
14 define void @test_negative() {
15 ; CHECK-LABEL: @test_negative
17 ; CHECK-NOT: statepoint
21 ; Do we insert a backedge safepoint in a statically
23 define void @test_backedge() gc "statepoint-example" {
24 ; CHECK-LABEL: test_backedge
27 ; This statepoint is technically not required, but we don't exploit that yet.
38 ; Check that we remove an unreachable block rather than trying
39 ; to insert a backedge safepoint
40 define void @test_unreachable() gc "statepoint-example" {
41 ; CHECK-LABEL: test_unreachable
48 ; CHECK-NOT: statepoint
55 ; Do we turn a call into it's own statepoint
56 define void @test_simple_call() gc "statepoint-example" {
57 ; CHECK-LABEL: test_simple_call
63 ; CHECK-NOT: gc.result
68 declare zeroext i1 @i1_return_i1(i1)
70 define i1 @test_call_with_result() gc "statepoint-example" {
71 ; CHECK-LABEL: test_call_with_result
72 ; This is checking that a statepoint_poll + statepoint + result is
73 ; inserted for a function that takes 1 argument.
74 ; CHECK: gc.statepoint.p0f_isVoidf
75 ; CHECK: gc.statepoint.p0f_i1i1f
76 ; CHECK: (i64 2882400000, i32 0, i1 (i1)* @i1_return_i1, i32 1, i32 0, i1 false, i32 0, i32 0)
77 ; CHECK: %call12 = call i1 @llvm.experimental.gc.result.i1
79 %call1 = tail call i1 (i1) @i1_return_i1(i1 false)
83 ; This function is inlined when inserting a poll. To avoid recursive
84 ; issues, make sure we don't place safepoints in it.
85 declare void @do_safepoint()
86 define void @gc.safepoint_poll() {
87 ; CHECK-LABEL: gc.safepoint_poll
89 ; CHECK-NEXT: do_safepoint
90 ; CHECK-NEXT: ret void
92 call void @do_safepoint()