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