23 lines · plain
1; RUN: opt < %s -passes='cgscc(inline)' -S | grep example2 3 %IntArray = type { i32, [0 x ptr] }4 5declare void @llvm.gcroot(ptr, ptr) nounwind6 7define i32 @f() {8 %x = call i32 @g( ) ; <i32> [#uses=1]9 ret i32 %x10}11 12define internal i32 @g() gc "example" {13 %root = alloca ptr ; <ptr> [#uses=2]14 call void @llvm.gcroot( ptr %root, ptr null )15 %obj = call ptr @h( ) ; <ptr> [#uses=2]16 store ptr %obj, ptr %root17 %Length.ptr = getelementptr %IntArray, ptr %obj, i32 0, i32 0 ; <ptr> [#uses=1]18 %Length = load i32, ptr %Length.ptr ; <i32> [#uses=1]19 ret i32 %Length20}21 22declare ptr @h()23