1; RUN: opt %s -S -place-safepoints | FileCheck %s 2 3 4; Do we insert a simple entry safepoint? 5define void @test_entry() gc "statepoint-example" { 6; CHECK-LABEL: @test_entry 7entry: 8; CHECK-LABEL: entry 9; CHECK: statepoint 10 ret void 11} 12 13; Do we insert a backedge safepoint in a statically 14; infinite loop? 15define void @test_backedge() gc "statepoint-example" { 16; CHECK-LABEL: test_backedge 17entry: 18; CHECK-LABEL: entry 19; This statepoint is technically not required, but we don't exploit that yet. 20; CHECK: statepoint 21 br label %other 22 23; CHECK-LABEL: other 24; CHECK: statepoint 25other: 26 call void undef() 27 br label %other 28} 29 30; Check that we remove an unreachable block rather than trying 31; to insert a backedge safepoint 32define void @test_unreachable() gc "statepoint-example" { 33; CHECK-LABEL: test_unreachable 34entry: 35; CHECK-LABEL: entry 36; CHECK: statepoint 37 ret void 38 39; CHECK-NOT: other 40; CHECK-NOT: statepoint 41other: 42 br label %other 43} 44 45declare void @foo() 46 47; Do we turn a call into it's own statepoint 48define void @test_simple_call() gc "statepoint-example" { 49; CHECK-LABEL: test_simple_call 50entry: 51 br label %other 52other: 53; CHECK-LABEL: other 54; CHECK: statepoint 55 call void @foo() 56 ret void 57} 58 59 60; This function is inlined when inserting a poll. To avoid recursive 61; issues, make sure we don't place safepoints in it. 62declare void @do_safepoint() 63define void @gc.safepoint_poll() { 64; CHECK-LABEL: gc.safepoint_poll 65; CHECK-LABEL: entry 66; CHECK-NEXT: do_safepoint 67; CHECK-NEXT: ret void 68entry: 69 call void @do_safepoint() 70 ret void 71} 72