[llvm-dev] Are derived pointers caught by RS4GC?

Kavindu Gimhan Zoysa via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 20 07:45:56 PDT 2021


Hi all,

If I run the *--rewrite-statepoints-for-gc, *against an LLVM IR with a
derived pointer, that pointer is not caught by RS4GC pass as a live
pointer. Is this the expected behavior?

This is the sample code I ran.

define void @dummy_func() {
>   ret void
> }
> define i8 addrspace(1)* @test1(i8 addrspace(1)* %obj) gc
> "statepoint-example" {
>   %gep = getelementptr i8, i8 addrspace(1)* %obj, i64 20000
>   call void @dummy_func()
>   %p = getelementptr i8, i8 addrspace(1)* %gep, i64 -20000
>   store i8 2, i8 addrspace(1)* %gep
>   ret i8 addrspace(1)* %p
> }
> define dso_local void @main() #0 {
>   %1 = alloca i8*, align 8
>   %2 = call noalias i8 addrspace(1)* @malloc(i64 8) #3
>   %3 = call i8 addrspace(1)* @test1(i8 addrspace(1)* %2)
>   ret void
> }
> declare dso_local noalias i8 addrspace(1)* @malloc(i64) #1


Since *%gep *is a derived pointer, I expect it should be identified as a
live pointer for RS4GC as explained in
https://releases.llvm.org/11.0.1/docs/Statepoints.html#base-derived-pointers
.

Really appreciate your input about this.

Thank you,
Kavindu

Kavindu Gimhan Zoysa,
BSc(Hons) | ENTC | UoM,
ATL | WSO2

GitHub <https://github.com/KavinduZoysa> LinkedIn
<https://www.linkedin.com/in/kavindu-gimhan-zoysa-85939a122/> Medium
<https://medium.com/@kavindugimhanzoysa>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210720/753e0765/attachment.html>


More information about the llvm-dev mailing list