1 ; RUN: opt -S -place-safepoints < %s | FileCheck %s
3 ; Libcalls will not contain a safepoint poll, so check that we insert
4 ; a safepoint in a loop containing a libcall.
5 declare double @ldexp(double %x, i32 %n) nounwind readnone
6 define double @test_libcall(double %x) gc "statepoint-example" {
7 ; CHECK-LABEL: test_libcall
11 ; CHECK-NEXT: call void @do_safepoint
12 ; CHECK-NEXT: br label %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
26 %x_end = phi double [%x_exp, %loop]
30 ; This function is inlined when inserting a poll.
31 declare void @do_safepoint()
32 define void @gc.safepoint_poll() {
33 ; CHECK-LABEL: gc.safepoint_poll
35 call void @do_safepoint()