1; RUN: opt %s -S -place-safepoints | FileCheck %s 2 3 4; Do we insert a simple entry safepoint? 5define void @test_entry(i8 addrspace(1)* %arg) { 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(i8 addrspace(1)* %arg) { 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 %tmp = bitcast i8 addrspace(1)* %arg to i32 addrspace(1)* 27 call void undef() 28 br label %other 29} 30 31; Check that we remove an unreachable block rather than trying 32; to insert a backedge safepoint 33define void @test_unreachable(i8 addrspace(1)* %arg) { 34; CHECK-LABEL: test_unreachable 35entry: 36; CHECK-LABEL: entry 37; CHECK: statepoint 38 ret void 39 40; CHECK-NOT: other 41; CHECK-NOT: statepoint 42other: 43 br label %other 44} 45 46declare void @foo() 47 48; Do we turn a call into it's own statepoint 49define void @test_simple_call() { 50; CHECK-LABEL: test_simple_call 51entry: 52 br label %other 53other: 54; CHECK-LABEL: other 55; CHECK: statepoint 56 call void @foo() 57 ret void 58} 59 60 61; This function is inlined when inserting a poll. To avoid recursive 62; issues, make sure we don't place safepoints in it. 63declare void @do_safepoint() 64define void @gc.safepoint_poll() { 65; CHECK-LABEL: gc.safepoint_poll 66; CHECK-LABEL: entry 67; CHECK-NEXT: do_safepoint 68; CHECK-NEXT: ret void 69entry: 70 call void @do_safepoint() 71 ret void 72} 73