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
9 ; CHECK: call void @do_safepoint
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: do_safepoint
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.
28 ; CHECK: call void @do_safepoint
32 ; CHECK: call void @do_safepoint
37 ; Check that we remove an unreachable block rather than trying
38 ; to insert a backedge safepoint
39 define void @test_unreachable() gc "statepoint-example" {
40 ; CHECK-LABEL: test_unreachable
43 ; CHECK: call void @do_safepoint
47 ; CHECK-NOT: do_safepoint
54 declare zeroext i1 @i1_return_i1(i1)
56 define i1 @test_call_with_result() gc "statepoint-example" {
57 ; CHECK-LABEL: test_call_with_result
58 ; This is checking that a statepoint_poll is inserted for a function
59 ; that takes 1 argument.
60 ; CHECK: call void @do_safepoint
62 %call1 = tail call i1 (i1) @i1_return_i1(i1 false)
66 ; This function is inlined when inserting a poll. To avoid recursive
67 ; issues, make sure we don't place safepoints in it.
68 declare void @do_safepoint()
69 define void @gc.safepoint_poll() {
70 ; CHECK-LABEL: gc.safepoint_poll
72 ; CHECK-NEXT: do_safepoint
73 ; CHECK-NEXT: ret void
75 call void @do_safepoint()