Hello list,
I’m experimenting with proof of concept statepoint GC for LLVM and currently trying to follow some guidelines of http://llvm.org/docs/Statepoints.html
Namely applying PlaceSafepoints should introduce statepoint intrinsics at the right spots in the IR. Following the given example http://llvm.org/docs/Statepoints.html#placesafepoints I did:
dmitryolsh$ cat sp.ll
declare void @foo()
define void @test() gc “statepoint-example” {
call void @foo()
ret void
}
declare void @do_safepoint()
define void @gc.safepoint_poll() {
call void @do_safepoint()
ret void
}
#Applying the place-safepoints:
dmitryolsh$ opt -place-safepoints -S sp.ll
; ModuleID = ‘sp.ll’
source_filename = “sp.ll”
declare void @foo()
define void @test() gc “statepoint-example” {
call void @do_safepoint()
call void @foo()
ret void
}
declare void @do_safepoint()
define void @gc.safepoint_poll() {
call void @do_safepoint()
ret void
}
This is compared to the expected output with intrinsics:
define void @test() gc “statepoint-example” {
%safepoint_token = call token (i64, i32, void (), i32, i32, …) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0)
%safepoint_token1 = call token (i64, i32, void (), i32, i32, …) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0)
ret void
}
So it doesn’t quite work as advertised. Am I missing something obvious or is it a bug in docs/pass ?