24 lines · plain
1; RUN: opt < %s -passes='cgscc(inline)' -S | grep sample2; RUN: opt < %s -passes='cgscc(inline)' -S | grep example3 4 %IntArray = type { i32, [0 x ptr] }5 6declare void @llvm.gcroot(ptr, ptr) nounwind7 8define i32 @f() gc "sample" {9 %x = call i32 @g( ) ; <i32> [#uses=1]10 ret i32 %x11}12 13define internal i32 @g() gc "example" {14 %root = alloca ptr ; <ptr> [#uses=2]15 call void @llvm.gcroot( ptr %root, ptr null )16 %obj = call ptr @h( ) ; <ptr> [#uses=2]17 store ptr %obj, ptr %root18 %Length.ptr = getelementptr %IntArray, ptr %obj, i32 0, i32 0 ; <ptr> [#uses=1]19 %Length = load i32, ptr %Length.ptr ; <i32> [#uses=1]20 ret i32 %Length21}22 23declare ptr @h()24