I have statepoint calls in my generated IR, but for some reason, no matter what values I put in the gc-live
bundle, it always gives the same output for every stack map entry:
Record ID: 43708, instruction offset: 183
3 locations:
#1: Constant 0, size: 8
#2: Constant 1, size: 8
#3: Constant 0, size: 8
0 live-outs: [ ]
I have a simple reproducer here: Compiler Explorer (Unfortunately one has to semi-manually parse the stack map output, but it is short enough and matches the output above.)
One other thing I noticed is that the docs give this syntax:
declare token
@llvm.experimental.gc.statepoint(i64 <id>, i32 <num patch bytes>,
ptr elementtype(func_type) <target>,
i64 <#call args>, i64 <flags>,
... (call parameters),
i64 0, i64 0)
But if you don’t use i32
for <#call args>
and <flags>
, it gives you an error like this:
/opt/compiler-explorer/clang-trunk/bin/llc: error: /opt/compiler-explorer/clang-trunk/bin/llc: <source>:7:146: error: argument is not of expected type 'i32'
%res = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint(i64 123, i32 0, ptr elementtype(i32 (i32, %ref)) @process, i64 2, i32 1, i32 %x, %ref %y, i64 0, i64 0) [ "gc-live"(%ref %y) ]
So I guess the docs are incorrect?