77 lines · plain
1; RUN: opt < %s -S -passes=place-safepoints | FileCheck %s2 3; Do we insert a simple entry safepoint?4define void @test_entry() gc "statepoint-example" {5; CHECK-LABEL: @test_entry6entry:7; CHECK-LABEL: entry8; CHECK: call void @do_safepoint9 ret void10}11 12; On a non-gc function, we should NOT get an entry safepoint13define void @test_negative() {14; CHECK-LABEL: @test_negative15entry:16; CHECK-NOT: do_safepoint17 ret void18}19 20; Do we insert a backedge safepoint in a statically21; infinite loop?22define void @test_backedge() gc "statepoint-example" {23; CHECK-LABEL: test_backedge24entry:25; CHECK-LABEL: entry26; This statepoint is technically not required, but we don't exploit that yet.27; CHECK: call void @do_safepoint28 br label %other29 30; CHECK-LABEL: other31; CHECK: call void @do_safepoint32other:33 br label %other34}35 36; Check that we remove an unreachable block rather than trying37; to insert a backedge safepoint38define void @test_unreachable() gc "statepoint-example" {39; CHECK-LABEL: test_unreachable40entry:41; CHECK-LABEL: entry42; CHECK: call void @do_safepoint43 ret void44 45; CHECK-NOT: other46; CHECK-NOT: do_safepoint47other:48 br label %other49}50 51declare void @foo()52 53declare zeroext i1 @i1_return_i1(i1)54 55define i1 @test_call_with_result() gc "statepoint-example" {56; CHECK-LABEL: test_call_with_result57; This is checking that a statepoint_poll is inserted for a function58; that takes 1 argument.59; CHECK: call void @do_safepoint60entry:61 %call1 = tail call i1 (i1) @i1_return_i1(i1 false)62 ret i1 %call163}64 65; This function is inlined when inserting a poll. To avoid recursive 66; issues, make sure we don't place safepoints in it.67declare void @do_safepoint()68define void @gc.safepoint_poll() {69; CHECK-LABEL: gc.safepoint_poll70; CHECK-LABEL: entry71; CHECK-NEXT: do_safepoint72; CHECK-NEXT: ret void 73entry:74 call void @do_safepoint()75 ret void76}77