Home | History | Annotate | Download | only in GC
      1 ; RUN: opt < %s -inline -S | grep sample
      2 ; RUN: opt < %s -inline -S | grep example
      3 
      4 	%IntArray = type { i32, [0 x i32*] }
      5 
      6 declare void @llvm.gcroot(i8**, i8*) nounwind 
      7 
      8 define i32 @f() gc "sample" {
      9 	%x = call i32 @g( )		; <i32> [#uses=1]
     10 	ret i32 %x
     11 }
     12 
     13 define internal i32 @g() gc "example" {
     14 	%root = alloca i8*		; <i8**> [#uses=2]
     15 	call void @llvm.gcroot( i8** %root, i8* null )
     16 	%obj = call %IntArray* @h( )		; <%IntArray*> [#uses=2]
     17 	%obj.2 = bitcast %IntArray* %obj to i8*		; <i8*> [#uses=1]
     18 	store i8* %obj.2, i8** %root
     19 	%Length.ptr = getelementptr %IntArray, %IntArray* %obj, i32 0, i32 0		; <i32*> [#uses=1]
     20 	%Length = load i32, i32* %Length.ptr		; <i32> [#uses=1]
     21 	ret i32 %Length
     22 }
     23 
     24 declare %IntArray* @h()
     25