1; RUN: opt -S -place-safepoints < %s | FileCheck %s 2 3; Libcalls will not contain a safepoint poll, so check that we insert 4; a safepoint in a loop containing a libcall. 5declare double @ldexp(double %x, i32 %n) nounwind readnone 6define double @test_libcall(double %x) gc "statepoint-example" { 7; CHECK-LABEL: test_libcall 8 9entry: 10; CHECK: entry 11; CHECK-NEXT: call void @do_safepoint 12; CHECK-NEXT: br label %loop 13 br label %loop 14 15loop: 16; CHECK: loop 17; CHECK-NEXT: %x_loop = phi double [ %x, %entry ], [ %x_exp, %loop ] 18; CHECK-NEXT: %x_exp = call double @ldexp(double %x_loop, i32 5) 19; CHECK-NEXT: %done = fcmp ogt double %x_exp, 1.5 20; CHECK-NEXT: call void @do_safepoint 21 %x_loop = phi double [ %x, %entry ], [ %x_exp, %loop ] 22 %x_exp = call double @ldexp(double %x_loop, i32 5) nounwind readnone 23 %done = fcmp ogt double %x_exp, 1.5 24 br i1 %done, label %end, label %loop 25end: 26 %x_end = phi double [%x_exp, %loop] 27 ret double %x_end 28} 29 30; This function is inlined when inserting a poll. 31declare void @do_safepoint() 32define void @gc.safepoint_poll() { 33; CHECK-LABEL: gc.safepoint_poll 34entry: 35 call void @do_safepoint() 36 ret void 37} 38