1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Transforms/PlaceSafepoints/libcall.ll
Eric Christopher a62270de2c Revert "Temporarily Revert "Add basic loop fusion pass.""
The reversion apparently deleted the test/Transforms directory.

Will be re-reverting again.

llvm-svn: 358552
2019-04-17 04:52:47 +00:00

38 lines
1.1 KiB
LLVM

; RUN: opt -S -place-safepoints < %s | FileCheck %s
; Libcalls will not contain a safepoint poll, so check that we insert
; a safepoint in a loop containing a libcall.
declare double @ldexp(double %x, i32 %n) nounwind readnone
define double @test_libcall(double %x) gc "statepoint-example" {
; CHECK-LABEL: test_libcall
entry:
; CHECK: entry
; CHECK-NEXT: call void @do_safepoint
; CHECK-NEXT: br label %loop
br label %loop
loop:
; CHECK: loop
; CHECK-NEXT: %x_loop = phi double [ %x, %entry ], [ %x_exp, %loop ]
; CHECK-NEXT: %x_exp = call double @ldexp(double %x_loop, i32 5)
; CHECK-NEXT: %done = fcmp ogt double %x_exp, 1.5
; CHECK-NEXT: call void @do_safepoint
%x_loop = phi double [ %x, %entry ], [ %x_exp, %loop ]
%x_exp = call double @ldexp(double %x_loop, i32 5) nounwind readnone
%done = fcmp ogt double %x_exp, 1.5
br i1 %done, label %end, label %loop
end:
%x_end = phi double [%x_exp, %loop]
ret double %x_end
}
; This function is inlined when inserting a poll.
declare void @do_safepoint()
define void @gc.safepoint_poll() {
; CHECK-LABEL: gc.safepoint_poll
entry:
call void @do_safepoint()
ret void
}