don't have i386-specific tests in CodeGen/Generic, PR6601.
authorChris Lattner <sabre@nondot.org>
Sun, 14 Mar 2010 18:51:18 +0000 (18:51 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 14 Mar 2010 18:51:18 +0000 (18:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98508 91177308-0d34-0410-b5e6-96231b3b80d8

37 files changed:
test/CodeGen/Generic/2007-02-16-BranchFold.ll [deleted file]
test/CodeGen/Generic/2007-04-13-SwitchLowerBadPhi.ll
test/CodeGen/Generic/2007-05-05-Personality.ll [deleted file]
test/CodeGen/Generic/2007-11-21-UndeadIllegalNode.ll
test/CodeGen/Generic/2007-12-17-InvokeAsm.ll
test/CodeGen/Generic/2007-12-31-UnusedSelector.ll
test/CodeGen/Generic/2008-08-07-PtrToInt-SmallerInt.ll
test/CodeGen/Generic/2009-11-16-BadKillsCrash.ll
test/CodeGen/Generic/GC/alloc_loop.ll [deleted file]
test/CodeGen/Generic/GC/argpromotion.ll [deleted file]
test/CodeGen/Generic/GC/badreadproto.ll [deleted file]
test/CodeGen/Generic/GC/badrootproto.ll [deleted file]
test/CodeGen/Generic/GC/badwriteproto.ll [deleted file]
test/CodeGen/Generic/GC/deadargelim.ll [deleted file]
test/CodeGen/Generic/GC/dg.exp [deleted file]
test/CodeGen/Generic/GC/fat.ll [deleted file]
test/CodeGen/Generic/GC/inline.ll [deleted file]
test/CodeGen/Generic/GC/inline2.ll [deleted file]
test/CodeGen/Generic/GC/lower_gcroot.ll [deleted file]
test/CodeGen/Generic/GC/outside.ll [deleted file]
test/CodeGen/Generic/GC/redundant_init.ll [deleted file]
test/CodeGen/Generic/GC/simple_ocaml.ll [deleted file]
test/CodeGen/X86/2007-02-16-BranchFold.ll [new file with mode: 0644]
test/CodeGen/X86/2007-05-05-Personality.ll [new file with mode: 0644]
test/CodeGen/X86/GC/alloc_loop.ll [new file with mode: 0644]
test/CodeGen/X86/GC/argpromotion.ll [new file with mode: 0644]
test/CodeGen/X86/GC/badreadproto.ll [new file with mode: 0644]
test/CodeGen/X86/GC/badrootproto.ll [new file with mode: 0644]
test/CodeGen/X86/GC/badwriteproto.ll [new file with mode: 0644]
test/CodeGen/X86/GC/deadargelim.ll [new file with mode: 0644]
test/CodeGen/X86/GC/dg.exp [new file with mode: 0644]
test/CodeGen/X86/GC/fat.ll [new file with mode: 0644]
test/CodeGen/X86/GC/inline.ll [new file with mode: 0644]
test/CodeGen/X86/GC/inline2.ll [new file with mode: 0644]
test/CodeGen/X86/GC/lower_gcroot.ll [new file with mode: 0644]
test/CodeGen/X86/GC/outside.ll [new file with mode: 0644]
test/CodeGen/X86/GC/simple_ocaml.ll [new file with mode: 0644]

diff --git a/test/CodeGen/Generic/2007-02-16-BranchFold.ll b/test/CodeGen/Generic/2007-02-16-BranchFold.ll
deleted file mode 100644 (file)
index 6bf5631..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-; PR 1200
-; RUN: llc < %s -enable-tail-merge=0 | not grep jmp 
-
-; ModuleID = '<stdin>'
-target datalayout = "e-p:32:32"
-target triple = "i686-apple-darwin8"
-       %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
-       %struct.Index_Map = type { i32, %struct.item_set** }
-       %struct.Item = type { [4 x i16], %struct.rule* }
-       %struct.__sFILEX = type opaque
-       %struct.__sbuf = type { i8*, i32 }
-       %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* }
-       %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* }
-       %struct.list = type { i8*, %struct.list* }
-       %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** }
-       %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* }
-       %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* }
-       %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] }
-       %struct.plank = type { i8*, %struct.list*, i32 }
-       %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* }
-       %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 }
-       %struct.stateMap = type { i8*, %struct.plank*, i32, i16* }
-       %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** }
-@outfile = external global %struct.FILE*               ; <%struct.FILE**> [#uses=1]
-@str1 = external global [11 x i8]              ; <[11 x i8]*> [#uses=1]
-
-declare i32 @fprintf(%struct.FILE*, i8*, ...)
-
-define i16 @main_bb_2E_i9_2E_i_2E_i932_2E_ce(%struct.list* %l_addr.01.0.i2.i.i929, %struct.operator** %tmp66.i62.i.out) {
-newFuncRoot:
-       br label %bb.i9.i.i932.ce
-
-NewDefault:            ; preds = %LeafBlock, %LeafBlock1, %LeafBlock2, %LeafBlock3
-       br label %bb36.i.i.exitStub
-
-bb36.i.i.exitStub:             ; preds = %NewDefault
-       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
-       ret i16 0
-
-bb.i14.i.exitStub:             ; preds = %LeafBlock
-       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
-       ret i16 1
-
-bb12.i.i935.exitStub:          ; preds = %LeafBlock1
-       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
-       ret i16 2
-
-bb20.i.i937.exitStub:          ; preds = %LeafBlock2
-       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
-       ret i16 3
-
-bb28.i.i938.exitStub:          ; preds = %LeafBlock3
-       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
-       ret i16 4
-
-bb.i9.i.i932.ce:               ; preds = %newFuncRoot
-       %tmp1.i3.i.i930 = getelementptr %struct.list* %l_addr.01.0.i2.i.i929, i32 0, i32 0              ; <i8**> [#uses=1]
-       %tmp2.i4.i.i931 = load i8** %tmp1.i3.i.i930             ; <i8*> [#uses=1]
-       %tmp66.i62.i = bitcast i8* %tmp2.i4.i.i931 to %struct.operator*         ; <%struct.operator*> [#uses=7]
-       %tmp1.i6.i = getelementptr %struct.operator* %tmp66.i62.i, i32 0, i32 2         ; <i32*> [#uses=1]
-       %tmp2.i7.i = load i32* %tmp1.i6.i               ; <i32> [#uses=1]
-       %tmp3.i8.i = load %struct.FILE** @outfile               ; <%struct.FILE*> [#uses=1]
-       %tmp5.i9.i = call i32 (%struct.FILE*, i8*, ...)* @fprintf( %struct.FILE* %tmp3.i8.i, i8* getelementptr ([11 x i8]* @str1, i32 0, i32 0), i32 %tmp2.i7.i )               ; <i32> [#uses=0]
-       %tmp7.i10.i = getelementptr %struct.operator* %tmp66.i62.i, i32 0, i32 5                ; <i32*> [#uses=1]
-       %tmp8.i11.i = load i32* %tmp7.i10.i             ; <i32> [#uses=7]
-       br label %NodeBlock5
-
-NodeBlock5:            ; preds = %bb.i9.i.i932.ce
-       icmp slt i32 %tmp8.i11.i, 1             ; <i1>:0 [#uses=1]
-       br i1 %0, label %NodeBlock, label %NodeBlock4
-
-NodeBlock4:            ; preds = %NodeBlock5
-       icmp slt i32 %tmp8.i11.i, 2             ; <i1>:1 [#uses=1]
-       br i1 %1, label %LeafBlock2, label %LeafBlock3
-
-LeafBlock3:            ; preds = %NodeBlock4
-       icmp eq i32 %tmp8.i11.i, 2              ; <i1>:2 [#uses=1]
-       br i1 %2, label %bb28.i.i938.exitStub, label %NewDefault
-
-LeafBlock2:            ; preds = %NodeBlock4
-       icmp eq i32 %tmp8.i11.i, 1              ; <i1>:3 [#uses=1]
-       br i1 %3, label %bb20.i.i937.exitStub, label %NewDefault
-
-NodeBlock:             ; preds = %NodeBlock5
-       icmp slt i32 %tmp8.i11.i, 0             ; <i1>:4 [#uses=1]
-       br i1 %4, label %LeafBlock, label %LeafBlock1
-
-LeafBlock1:            ; preds = %NodeBlock
-       icmp eq i32 %tmp8.i11.i, 0              ; <i1>:5 [#uses=1]
-       br i1 %5, label %bb12.i.i935.exitStub, label %NewDefault
-
-LeafBlock:             ; preds = %NodeBlock
-       icmp eq i32 %tmp8.i11.i, -1             ; <i1>:6 [#uses=1]
-       br i1 %6, label %bb.i14.i.exitStub, label %NewDefault
-}
index a0b1403cf8d12f35ce289eb775df5062d54ff076..9c3c804aa7544264c372c06fbad6ce0b186d717e 100644 (file)
@@ -1,9 +1,6 @@
 ; RUN: llc < %s -O0
 ; PR 1323
 
-; ModuleID = 'test.bc'
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
-target triple = "i686-apple-darwin8"
        %struct.comp = type { i8*, i32, i8*, [3 x i8], i32 }
 
 define void @regbranch() {
diff --git a/test/CodeGen/Generic/2007-05-05-Personality.ll b/test/CodeGen/Generic/2007-05-05-Personality.ll
deleted file mode 100644 (file)
index c92783e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-; RUN: llc < %s -mtriple=i686-pc-linux-gnu -enable-eh -o - | grep zPL
-
-@error = external global i8            ; <i8*> [#uses=2]
-
-define void @_ada_x() {
-entry:
-       invoke void @raise( )
-                       to label %eh_then unwind label %unwind
-
-unwind:                ; preds = %entry
-       %eh_ptr = tail call i8* @llvm.eh.exception( )           ; <i8*> [#uses=2]
-       %eh_select = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i8* @error )            ; <i32> [#uses=1]
-       %eh_typeid = tail call i32 @llvm.eh.typeid.for.i32( i8* @error )                ; <i32> [#uses=1]
-       %tmp2 = icmp eq i32 %eh_select, %eh_typeid              ; <i1> [#uses=1]
-       br i1 %tmp2, label %eh_then, label %Unwind
-
-eh_then:               ; preds = %unwind, %entry
-       ret void
-
-Unwind:                ; preds = %unwind
-       tail call i32 (...)* @_Unwind_Resume( i8* %eh_ptr )             ; <i32>:0 [#uses=0]
-       unreachable
-}
-
-declare void @raise()
-
-declare i8* @llvm.eh.exception()
-
-declare i32 @llvm.eh.selector.i32(i8*, i8*, ...)
-
-declare i32 @llvm.eh.typeid.for.i32(i8*)
-
-declare i32 @__gnat_eh_personality(...)
-
-declare i32 @_Unwind_Resume(...)
index e220be6389dc640436bb9cdb44415dafbe3b5383..3090857d96493ca53b12f0b13b6652970a1bbd3f 100644 (file)
@@ -1,7 +1,5 @@
 ; RUN: llc < %s -o -
 
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
-target triple = "i686-pc-linux-gnu"
        %struct.RETURN = type { i32, i32 }
        %struct.ada__finalization__controlled = type { %struct.system__finalization_root__root_controlled }
        %struct.ada__streams__root_stream_type = type { %struct.ada__tags__dispatch_table* }
index bd26481bd30601161555a89b6b2645e28bb1815f..4cc1e7c181ed28399e170fc45f02f2f4d8b19743 100644 (file)
@@ -1,7 +1,5 @@
 ; RUN: llc < %s -enable-eh
 
-target triple = "i686-pc-linux-gnu"
-
 define fastcc void @bc__support__high_resolution_time__initialize_clock_rate() {
 entry:
        invoke void asm "rdtsc\0A\09movl %eax, $0\0A\09movl %edx, $1", "=*imr,=*imr,~{dirflag},~{fpsr},~{flags},~{dx},~{ax}"( i32* null, i32* null )
index fc9164f7c4aa3c91be9cc194f246087a50e2434f..d2e97a477b449ace1e9a297288c0b7ea9b6586db 100644 (file)
@@ -1,8 +1,6 @@
 ; RUN: llc < %s -enable-eh
 ; PR1833
 
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
-target triple = "i686-pc-linux-gnu"
        %struct.__class_type_info_pseudo = type { %struct.__type_info_pseudo }
        %struct.__type_info_pseudo = type { i8*, i8* }
 @_ZTI2e1 = external constant %struct.__class_type_info_pseudo          ; <%struct.__class_type_info_pseudo*> [#uses=1]
index 4f95dfe8a730efd1b8885d626a673b73c0fa72b3..00ca8c756b425ee9813f5aa0dee98c49c561956e 100644 (file)
@@ -1,7 +1,5 @@
 ; RUN: llc < %s
 ; PR2603
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
-target triple = "i386-pc-linux-gnu"
         %struct.A = type { i8 }
         %struct.B = type { i8, [1 x i8] }
 @Foo = constant %struct.A { i8 ptrtoint (i8* getelementptr ([1 x i8]* inttoptr (i32 17 to [1 x i8]*), i32 0, i32 -16) to i8) }          ; <%struct.A*> [#uses=0]
index a51c75d6222451dd1f07030398bfe0c8f542c792..22bd4d7e6a412f0054862a6abb0f97bbb3ebb6c8 100644 (file)
@@ -1,7 +1,5 @@
 ; RUN: llc < %s
 ; PR5495
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
-target triple = "i386-pc-linux-gnu"
 
 %"struct.std::__ctype_abstract_base<wchar_t>" = type { %"struct.std::locale::facet" }
 %"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i8, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::__ctype_abstract_base<wchar_t>"*, %"struct.std::__ctype_abstract_base<wchar_t>"* }
diff --git a/test/CodeGen/Generic/GC/alloc_loop.ll b/test/CodeGen/Generic/GC/alloc_loop.ll
deleted file mode 100644 (file)
index fb78ba2..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-; RUN: llc < %s
-
-
-declare i8* @llvm_gc_allocate(i32)
-declare void @llvm_gc_initialize(i32)
-
-declare void @llvm.gcroot(i8**, i8*)
-declare void @llvm.gcwrite(i8*, i8*, i8**)
-
-define i32 @main() gc "shadow-stack" {
-entry:
-       %A = alloca i8*
-       %B = alloca i8**
-
-       call void @llvm_gc_initialize(i32 1048576)  ; Start with 1MB heap
-
-        ;; void *A;
-       call void @llvm.gcroot(i8** %A, i8* null)
-
-        ;; A = gcalloc(10);
-       %Aptr = call i8* @llvm_gc_allocate(i32 10)
-       store i8* %Aptr, i8** %A
-
-        ;; void **B;
-       %tmp.1 = bitcast i8*** %B to i8**
-       call void @llvm.gcroot(i8** %tmp.1, i8* null)
-
-       ;; B = gcalloc(4);
-       %B.upgrd.1 = call i8* @llvm_gc_allocate(i32 8)
-       %tmp.2 = bitcast i8* %B.upgrd.1 to i8**
-       store i8** %tmp.2, i8*** %B
-
-       ;; *B = A;
-       %B.1 = load i8*** %B
-       %A.1 = load i8** %A
-       call void @llvm.gcwrite(i8* %A.1, i8* %B.upgrd.1, i8** %B.1)
-       
-       br label %AllocLoop
-
-AllocLoop:
-       %i = phi i32 [ 0, %entry ], [ %indvar.next, %AllocLoop ]
-        ;; Allocated mem: allocated memory is immediately dead.
-       call i8* @llvm_gc_allocate(i32 100)
-       
-       %indvar.next = add i32 %i, 1
-       %exitcond = icmp eq i32 %indvar.next, 10000000
-       br i1 %exitcond, label %Exit, label %AllocLoop
-
-Exit:
-       ret i32 0
-}
-
-declare void @__main()
diff --git a/test/CodeGen/Generic/GC/argpromotion.ll b/test/CodeGen/Generic/GC/argpromotion.ll
deleted file mode 100644 (file)
index c63ce22..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: opt < %s -argpromotion
-
-declare void @llvm.gcroot(i8**, i8*)
-
-define i32 @g() {
-entry:
-       %var = alloca i32
-       store i32 1, i32* %var
-       %x = call i32 @f(i32* %var)
-       ret i32 %x
-}
-
-define internal i32 @f(i32* %xp) gc "example" {
-entry:
-       %var = alloca i8*
-       call void @llvm.gcroot(i8** %var, i8* null)
-       %x = load i32* %xp
-       ret i32 %x
-}
diff --git a/test/CodeGen/Generic/GC/badreadproto.ll b/test/CodeGen/Generic/GC/badreadproto.ll
deleted file mode 100644 (file)
index 4fe90b9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-; RUN: not llvm-as < %s >& /dev/null
-
-       %list = type { i32, %list* }
-
-; This usage is invalid now; instead, objects must be bitcast to i8* for input
-; to the gc intrinsics.
-declare %list* @llvm.gcread(%list*, %list**)
-
-define %list* @tl(%list* %l) gc "example" {
-       %hd.ptr = getelementptr %list* %l, i32 0, i32 0
-       %hd = call %list* @llvm.gcread(%list* %l, %list** %hd.ptr)
-       ret i32 %tmp
-}
diff --git a/test/CodeGen/Generic/GC/badrootproto.ll b/test/CodeGen/Generic/GC/badrootproto.ll
deleted file mode 100644 (file)
index ff86d03..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-; RUN: not llvm-as < %s >& /dev/null
-
-       %list = type { i32, %list* }
-       %meta = type opaque
-
-; This usage is invalid now; instead, objects must be bitcast to i8* for input
-; to the gc intrinsics.
-declare void @llvm.gcroot(%list*, %meta*)
-
-define void @root() gc "example" {
-       %x.var = alloca i8*
-       call void @llvm.gcroot(i8** %x.var, %meta* null)
-}
diff --git a/test/CodeGen/Generic/GC/badwriteproto.ll b/test/CodeGen/Generic/GC/badwriteproto.ll
deleted file mode 100644 (file)
index be81f84..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-; RUN: not llvm-as < %s >& /dev/null
-
-       %list = type { i32, %list* }
-
-; This usage is invalid now; instead, objects must be bitcast to i8* for input
-; to the gc intrinsics.
-declare void @llvm.gcwrite(%list*, %list*, %list**)
-
-define %list* @cons(i32 %hd, %list* %tl) gc "example" {
-       %tmp = call i8* @gcalloc(i32 bitcast(%list* getelementptr(%list* null, i32 1) to i32))
-       %cell = bitcast i8* %tmp to %list*
-       
-       %hd.ptr = getelementptr %list* %cell, i32 0, i32 0
-       store i32 %hd, i32* %hd.ptr
-       
-       %tl.ptr = getelementptr %list* %cell, i32 0, i32 0
-       call void @llvm.gcwrite(%list* %tl, %list* %cell, %list** %tl.ptr)
-       
-       ret %cell.2
-}
-
-declare i8* @gcalloc(i32)
diff --git a/test/CodeGen/Generic/GC/deadargelim.ll b/test/CodeGen/Generic/GC/deadargelim.ll
deleted file mode 100644 (file)
index 1760190..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-; RUN: opt < %s -deadargelim
-
-declare void @llvm.gcroot(i8**, i8*)
-
-define void @g() {
-entry:
-       call void @f(i32 0)
-       ret void
-}
-
-define internal void @f(i32 %unused) gc "example" {
-entry:
-       %var = alloca i8*
-       call void @llvm.gcroot(i8** %var, i8* null)
-       ret void
-}
diff --git a/test/CodeGen/Generic/GC/dg.exp b/test/CodeGen/Generic/GC/dg.exp
deleted file mode 100644 (file)
index f200589..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-load_lib llvm.exp
-
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/CodeGen/Generic/GC/fat.ll b/test/CodeGen/Generic/GC/fat.ll
deleted file mode 100644 (file)
index d05ca3d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: not llvm-as < %s >& /dev/null
-
-declare void @llvm.gcroot(i8**, i8*) nounwind
-
-define void @f() gc "x" {
-       %st = alloca { i8*, i1 }                ; <{ i8*, i1 }*> [#uses=1]
-       %st_ptr = bitcast { i8*, i1 }* %st to i8**              ; <i8**> [#uses=1]
-       call void @llvm.gcroot(i8** %st_ptr, i8* null)
-       ret void
-}
diff --git a/test/CodeGen/Generic/GC/inline.ll b/test/CodeGen/Generic/GC/inline.ll
deleted file mode 100644 (file)
index 9da33ae..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-; RUN: opt < %s -inline -S | grep example
-
-       %IntArray = type { i32, [0 x i32*] }
-
-declare void @llvm.gcroot(i8**, i8*) nounwind 
-
-define i32 @f() {
-       %x = call i32 @g( )             ; <i32> [#uses=1]
-       ret i32 %x
-}
-
-define internal i32 @g() gc "example" {
-       %root = alloca i8*              ; <i8**> [#uses=2]
-       call void @llvm.gcroot( i8** %root, i8* null )
-       %obj = call %IntArray* @h( )            ; <%IntArray*> [#uses=2]
-       %obj.2 = bitcast %IntArray* %obj to i8*         ; <i8*> [#uses=1]
-       store i8* %obj.2, i8** %root
-       %Length.ptr = getelementptr %IntArray* %obj, i32 0, i32 0               ; <i32*> [#uses=1]
-       %Length = load i32* %Length.ptr         ; <i32> [#uses=1]
-       ret i32 %Length
-}
-
-declare %IntArray* @h()
diff --git a/test/CodeGen/Generic/GC/inline2.ll b/test/CodeGen/Generic/GC/inline2.ll
deleted file mode 100644 (file)
index 1594705..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-; RUN: opt < %s -inline -S | grep sample
-; RUN: opt < %s -inline -S | grep example
-
-       %IntArray = type { i32, [0 x i32*] }
-
-declare void @llvm.gcroot(i8**, i8*) nounwind 
-
-define i32 @f() gc "sample" {
-       %x = call i32 @g( )             ; <i32> [#uses=1]
-       ret i32 %x
-}
-
-define internal i32 @g() gc "example" {
-       %root = alloca i8*              ; <i8**> [#uses=2]
-       call void @llvm.gcroot( i8** %root, i8* null )
-       %obj = call %IntArray* @h( )            ; <%IntArray*> [#uses=2]
-       %obj.2 = bitcast %IntArray* %obj to i8*         ; <i8*> [#uses=1]
-       store i8* %obj.2, i8** %root
-       %Length.ptr = getelementptr %IntArray* %obj, i32 0, i32 0               ; <i32*> [#uses=1]
-       %Length = load i32* %Length.ptr         ; <i32> [#uses=1]
-       ret i32 %Length
-}
-
-declare %IntArray* @h()
diff --git a/test/CodeGen/Generic/GC/lower_gcroot.ll b/test/CodeGen/Generic/GC/lower_gcroot.ll
deleted file mode 100644 (file)
index c2d418a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: llc < %s
-
-       %Env = type i8*
-
-define void @.main(%Env) gc "shadow-stack" {
-       %Root = alloca %Env
-       call void @llvm.gcroot( %Env* %Root, %Env null )
-       unreachable
-}
-
-declare void @llvm.gcroot(%Env*, %Env)
diff --git a/test/CodeGen/Generic/GC/outside.ll b/test/CodeGen/Generic/GC/outside.ll
deleted file mode 100644 (file)
index 2968c69..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: not llvm-as < %s >& /dev/null
-
-declare void @llvm.gcroot(i8**, i8*)
-
-define void @f(i8* %x) {
-       %root = alloca i8*
-       call void @llvm.gcroot(i8** %root, i8* null)
-       store i8* %x, i8** %root
-       ret void
-}
diff --git a/test/CodeGen/Generic/GC/redundant_init.ll b/test/CodeGen/Generic/GC/redundant_init.ll
deleted file mode 100644 (file)
index 10c70e7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-; RUN: llc < %s -march=x86 | \
-; RUN:   ignore grep {movl..0} | count 0
-
-%struct.obj = type { i8*, %struct.obj* }
-
-declare void @g() gc "shadow-stack"
-
-define void @f(i8* %o) gc "shadow-stack" {
-entry:
-       %root = alloca i8*
-       call void @llvm.gcroot(i8** %root, i8* null)
-       store i8* %o, i8** %root
-       call void @g()
-       ret void
-}
-
-declare void @llvm.gcroot(i8**, i8*)
diff --git a/test/CodeGen/Generic/GC/simple_ocaml.ll b/test/CodeGen/Generic/GC/simple_ocaml.ll
deleted file mode 100644 (file)
index f765dc0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-; RUN: llc < %s | grep caml.*__frametable
-; RUN: llc < %s -march=x86 | grep {movl        .0}
-
-%struct.obj = type { i8*, %struct.obj* }
-
-define %struct.obj* @fun(%struct.obj* %head) gc "ocaml" {
-entry:
-       %gcroot.0 = alloca i8*
-       %gcroot.1 = alloca i8*
-       
-       call void @llvm.gcroot(i8** %gcroot.0, i8* null)
-       call void @llvm.gcroot(i8** %gcroot.1, i8* null)
-       
-       %local.0 = bitcast i8** %gcroot.0 to %struct.obj**
-       %local.1 = bitcast i8** %gcroot.1 to %struct.obj**
-
-       store %struct.obj* %head, %struct.obj** %local.0
-       br label %bb.loop
-bb.loop:
-       %t0 = load %struct.obj** %local.0
-       %t1 = getelementptr %struct.obj* %t0, i32 0, i32 1
-       %t2 = bitcast %struct.obj* %t0 to i8*
-       %t3 = bitcast %struct.obj** %t1 to i8**
-       %t4 = call i8* @llvm.gcread(i8* %t2, i8** %t3)
-       %t5 = bitcast i8* %t4 to %struct.obj*
-       %t6 = icmp eq %struct.obj* %t5, null
-       br i1 %t6, label %bb.loop, label %bb.end
-bb.end:
-       %t7 = malloc %struct.obj
-       store %struct.obj* %t7, %struct.obj** %local.1
-       %t8 = bitcast %struct.obj* %t7 to i8*
-       %t9 = load %struct.obj** %local.0
-       %t10 = getelementptr %struct.obj* %t9, i32 0, i32 1
-       %t11 = bitcast %struct.obj* %t9 to i8*
-       %t12 = bitcast %struct.obj** %t10 to i8**
-       call void @llvm.gcwrite(i8* %t8, i8* %t11, i8** %t12)
-       ret %struct.obj* %t7
-}
-
-declare void @llvm.gcroot(i8** %value, i8* %tag)
-declare void @llvm.gcwrite(i8* %value, i8* %obj, i8** %field)
-declare i8* @llvm.gcread(i8* %obj, i8** %field)
diff --git a/test/CodeGen/X86/2007-02-16-BranchFold.ll b/test/CodeGen/X86/2007-02-16-BranchFold.ll
new file mode 100644 (file)
index 0000000..6bf5631
--- /dev/null
@@ -0,0 +1,95 @@
+; PR 1200
+; RUN: llc < %s -enable-tail-merge=0 | not grep jmp 
+
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8"
+       %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+       %struct.Index_Map = type { i32, %struct.item_set** }
+       %struct.Item = type { [4 x i16], %struct.rule* }
+       %struct.__sFILEX = type opaque
+       %struct.__sbuf = type { i8*, i32 }
+       %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* }
+       %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* }
+       %struct.list = type { i8*, %struct.list* }
+       %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** }
+       %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* }
+       %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* }
+       %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] }
+       %struct.plank = type { i8*, %struct.list*, i32 }
+       %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* }
+       %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 }
+       %struct.stateMap = type { i8*, %struct.plank*, i32, i16* }
+       %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** }
+@outfile = external global %struct.FILE*               ; <%struct.FILE**> [#uses=1]
+@str1 = external global [11 x i8]              ; <[11 x i8]*> [#uses=1]
+
+declare i32 @fprintf(%struct.FILE*, i8*, ...)
+
+define i16 @main_bb_2E_i9_2E_i_2E_i932_2E_ce(%struct.list* %l_addr.01.0.i2.i.i929, %struct.operator** %tmp66.i62.i.out) {
+newFuncRoot:
+       br label %bb.i9.i.i932.ce
+
+NewDefault:            ; preds = %LeafBlock, %LeafBlock1, %LeafBlock2, %LeafBlock3
+       br label %bb36.i.i.exitStub
+
+bb36.i.i.exitStub:             ; preds = %NewDefault
+       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
+       ret i16 0
+
+bb.i14.i.exitStub:             ; preds = %LeafBlock
+       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
+       ret i16 1
+
+bb12.i.i935.exitStub:          ; preds = %LeafBlock1
+       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
+       ret i16 2
+
+bb20.i.i937.exitStub:          ; preds = %LeafBlock2
+       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
+       ret i16 3
+
+bb28.i.i938.exitStub:          ; preds = %LeafBlock3
+       store %struct.operator* %tmp66.i62.i, %struct.operator** %tmp66.i62.i.out
+       ret i16 4
+
+bb.i9.i.i932.ce:               ; preds = %newFuncRoot
+       %tmp1.i3.i.i930 = getelementptr %struct.list* %l_addr.01.0.i2.i.i929, i32 0, i32 0              ; <i8**> [#uses=1]
+       %tmp2.i4.i.i931 = load i8** %tmp1.i3.i.i930             ; <i8*> [#uses=1]
+       %tmp66.i62.i = bitcast i8* %tmp2.i4.i.i931 to %struct.operator*         ; <%struct.operator*> [#uses=7]
+       %tmp1.i6.i = getelementptr %struct.operator* %tmp66.i62.i, i32 0, i32 2         ; <i32*> [#uses=1]
+       %tmp2.i7.i = load i32* %tmp1.i6.i               ; <i32> [#uses=1]
+       %tmp3.i8.i = load %struct.FILE** @outfile               ; <%struct.FILE*> [#uses=1]
+       %tmp5.i9.i = call i32 (%struct.FILE*, i8*, ...)* @fprintf( %struct.FILE* %tmp3.i8.i, i8* getelementptr ([11 x i8]* @str1, i32 0, i32 0), i32 %tmp2.i7.i )               ; <i32> [#uses=0]
+       %tmp7.i10.i = getelementptr %struct.operator* %tmp66.i62.i, i32 0, i32 5                ; <i32*> [#uses=1]
+       %tmp8.i11.i = load i32* %tmp7.i10.i             ; <i32> [#uses=7]
+       br label %NodeBlock5
+
+NodeBlock5:            ; preds = %bb.i9.i.i932.ce
+       icmp slt i32 %tmp8.i11.i, 1             ; <i1>:0 [#uses=1]
+       br i1 %0, label %NodeBlock, label %NodeBlock4
+
+NodeBlock4:            ; preds = %NodeBlock5
+       icmp slt i32 %tmp8.i11.i, 2             ; <i1>:1 [#uses=1]
+       br i1 %1, label %LeafBlock2, label %LeafBlock3
+
+LeafBlock3:            ; preds = %NodeBlock4
+       icmp eq i32 %tmp8.i11.i, 2              ; <i1>:2 [#uses=1]
+       br i1 %2, label %bb28.i.i938.exitStub, label %NewDefault
+
+LeafBlock2:            ; preds = %NodeBlock4
+       icmp eq i32 %tmp8.i11.i, 1              ; <i1>:3 [#uses=1]
+       br i1 %3, label %bb20.i.i937.exitStub, label %NewDefault
+
+NodeBlock:             ; preds = %NodeBlock5
+       icmp slt i32 %tmp8.i11.i, 0             ; <i1>:4 [#uses=1]
+       br i1 %4, label %LeafBlock, label %LeafBlock1
+
+LeafBlock1:            ; preds = %NodeBlock
+       icmp eq i32 %tmp8.i11.i, 0              ; <i1>:5 [#uses=1]
+       br i1 %5, label %bb12.i.i935.exitStub, label %NewDefault
+
+LeafBlock:             ; preds = %NodeBlock
+       icmp eq i32 %tmp8.i11.i, -1             ; <i1>:6 [#uses=1]
+       br i1 %6, label %bb.i14.i.exitStub, label %NewDefault
+}
diff --git a/test/CodeGen/X86/2007-05-05-Personality.ll b/test/CodeGen/X86/2007-05-05-Personality.ll
new file mode 100644 (file)
index 0000000..c92783e
--- /dev/null
@@ -0,0 +1,35 @@
+; RUN: llc < %s -mtriple=i686-pc-linux-gnu -enable-eh -o - | grep zPL
+
+@error = external global i8            ; <i8*> [#uses=2]
+
+define void @_ada_x() {
+entry:
+       invoke void @raise( )
+                       to label %eh_then unwind label %unwind
+
+unwind:                ; preds = %entry
+       %eh_ptr = tail call i8* @llvm.eh.exception( )           ; <i8*> [#uses=2]
+       %eh_select = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i8* @error )            ; <i32> [#uses=1]
+       %eh_typeid = tail call i32 @llvm.eh.typeid.for.i32( i8* @error )                ; <i32> [#uses=1]
+       %tmp2 = icmp eq i32 %eh_select, %eh_typeid              ; <i1> [#uses=1]
+       br i1 %tmp2, label %eh_then, label %Unwind
+
+eh_then:               ; preds = %unwind, %entry
+       ret void
+
+Unwind:                ; preds = %unwind
+       tail call i32 (...)* @_Unwind_Resume( i8* %eh_ptr )             ; <i32>:0 [#uses=0]
+       unreachable
+}
+
+declare void @raise()
+
+declare i8* @llvm.eh.exception()
+
+declare i32 @llvm.eh.selector.i32(i8*, i8*, ...)
+
+declare i32 @llvm.eh.typeid.for.i32(i8*)
+
+declare i32 @__gnat_eh_personality(...)
+
+declare i32 @_Unwind_Resume(...)
diff --git a/test/CodeGen/X86/GC/alloc_loop.ll b/test/CodeGen/X86/GC/alloc_loop.ll
new file mode 100644 (file)
index 0000000..fb78ba2
--- /dev/null
@@ -0,0 +1,53 @@
+; RUN: llc < %s
+
+
+declare i8* @llvm_gc_allocate(i32)
+declare void @llvm_gc_initialize(i32)
+
+declare void @llvm.gcroot(i8**, i8*)
+declare void @llvm.gcwrite(i8*, i8*, i8**)
+
+define i32 @main() gc "shadow-stack" {
+entry:
+       %A = alloca i8*
+       %B = alloca i8**
+
+       call void @llvm_gc_initialize(i32 1048576)  ; Start with 1MB heap
+
+        ;; void *A;
+       call void @llvm.gcroot(i8** %A, i8* null)
+
+        ;; A = gcalloc(10);
+       %Aptr = call i8* @llvm_gc_allocate(i32 10)
+       store i8* %Aptr, i8** %A
+
+        ;; void **B;
+       %tmp.1 = bitcast i8*** %B to i8**
+       call void @llvm.gcroot(i8** %tmp.1, i8* null)
+
+       ;; B = gcalloc(4);
+       %B.upgrd.1 = call i8* @llvm_gc_allocate(i32 8)
+       %tmp.2 = bitcast i8* %B.upgrd.1 to i8**
+       store i8** %tmp.2, i8*** %B
+
+       ;; *B = A;
+       %B.1 = load i8*** %B
+       %A.1 = load i8** %A
+       call void @llvm.gcwrite(i8* %A.1, i8* %B.upgrd.1, i8** %B.1)
+       
+       br label %AllocLoop
+
+AllocLoop:
+       %i = phi i32 [ 0, %entry ], [ %indvar.next, %AllocLoop ]
+        ;; Allocated mem: allocated memory is immediately dead.
+       call i8* @llvm_gc_allocate(i32 100)
+       
+       %indvar.next = add i32 %i, 1
+       %exitcond = icmp eq i32 %indvar.next, 10000000
+       br i1 %exitcond, label %Exit, label %AllocLoop
+
+Exit:
+       ret i32 0
+}
+
+declare void @__main()
diff --git a/test/CodeGen/X86/GC/argpromotion.ll b/test/CodeGen/X86/GC/argpromotion.ll
new file mode 100644 (file)
index 0000000..c63ce22
--- /dev/null
@@ -0,0 +1,19 @@
+; RUN: opt < %s -argpromotion
+
+declare void @llvm.gcroot(i8**, i8*)
+
+define i32 @g() {
+entry:
+       %var = alloca i32
+       store i32 1, i32* %var
+       %x = call i32 @f(i32* %var)
+       ret i32 %x
+}
+
+define internal i32 @f(i32* %xp) gc "example" {
+entry:
+       %var = alloca i8*
+       call void @llvm.gcroot(i8** %var, i8* null)
+       %x = load i32* %xp
+       ret i32 %x
+}
diff --git a/test/CodeGen/X86/GC/badreadproto.ll b/test/CodeGen/X86/GC/badreadproto.ll
new file mode 100644 (file)
index 0000000..4fe90b9
--- /dev/null
@@ -0,0 +1,13 @@
+; RUN: not llvm-as < %s >& /dev/null
+
+       %list = type { i32, %list* }
+
+; This usage is invalid now; instead, objects must be bitcast to i8* for input
+; to the gc intrinsics.
+declare %list* @llvm.gcread(%list*, %list**)
+
+define %list* @tl(%list* %l) gc "example" {
+       %hd.ptr = getelementptr %list* %l, i32 0, i32 0
+       %hd = call %list* @llvm.gcread(%list* %l, %list** %hd.ptr)
+       ret i32 %tmp
+}
diff --git a/test/CodeGen/X86/GC/badrootproto.ll b/test/CodeGen/X86/GC/badrootproto.ll
new file mode 100644 (file)
index 0000000..ff86d03
--- /dev/null
@@ -0,0 +1,13 @@
+; RUN: not llvm-as < %s >& /dev/null
+
+       %list = type { i32, %list* }
+       %meta = type opaque
+
+; This usage is invalid now; instead, objects must be bitcast to i8* for input
+; to the gc intrinsics.
+declare void @llvm.gcroot(%list*, %meta*)
+
+define void @root() gc "example" {
+       %x.var = alloca i8*
+       call void @llvm.gcroot(i8** %x.var, %meta* null)
+}
diff --git a/test/CodeGen/X86/GC/badwriteproto.ll b/test/CodeGen/X86/GC/badwriteproto.ll
new file mode 100644 (file)
index 0000000..be81f84
--- /dev/null
@@ -0,0 +1,22 @@
+; RUN: not llvm-as < %s >& /dev/null
+
+       %list = type { i32, %list* }
+
+; This usage is invalid now; instead, objects must be bitcast to i8* for input
+; to the gc intrinsics.
+declare void @llvm.gcwrite(%list*, %list*, %list**)
+
+define %list* @cons(i32 %hd, %list* %tl) gc "example" {
+       %tmp = call i8* @gcalloc(i32 bitcast(%list* getelementptr(%list* null, i32 1) to i32))
+       %cell = bitcast i8* %tmp to %list*
+       
+       %hd.ptr = getelementptr %list* %cell, i32 0, i32 0
+       store i32 %hd, i32* %hd.ptr
+       
+       %tl.ptr = getelementptr %list* %cell, i32 0, i32 0
+       call void @llvm.gcwrite(%list* %tl, %list* %cell, %list** %tl.ptr)
+       
+       ret %cell.2
+}
+
+declare i8* @gcalloc(i32)
diff --git a/test/CodeGen/X86/GC/deadargelim.ll b/test/CodeGen/X86/GC/deadargelim.ll
new file mode 100644 (file)
index 0000000..1760190
--- /dev/null
@@ -0,0 +1,16 @@
+; RUN: opt < %s -deadargelim
+
+declare void @llvm.gcroot(i8**, i8*)
+
+define void @g() {
+entry:
+       call void @f(i32 0)
+       ret void
+}
+
+define internal void @f(i32 %unused) gc "example" {
+entry:
+       %var = alloca i8*
+       call void @llvm.gcroot(i8** %var, i8* null)
+       ret void
+}
diff --git a/test/CodeGen/X86/GC/dg.exp b/test/CodeGen/X86/GC/dg.exp
new file mode 100644 (file)
index 0000000..f200589
--- /dev/null
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/CodeGen/X86/GC/fat.ll b/test/CodeGen/X86/GC/fat.ll
new file mode 100644 (file)
index 0000000..d05ca3d
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: not llvm-as < %s >& /dev/null
+
+declare void @llvm.gcroot(i8**, i8*) nounwind
+
+define void @f() gc "x" {
+       %st = alloca { i8*, i1 }                ; <{ i8*, i1 }*> [#uses=1]
+       %st_ptr = bitcast { i8*, i1 }* %st to i8**              ; <i8**> [#uses=1]
+       call void @llvm.gcroot(i8** %st_ptr, i8* null)
+       ret void
+}
diff --git a/test/CodeGen/X86/GC/inline.ll b/test/CodeGen/X86/GC/inline.ll
new file mode 100644 (file)
index 0000000..9da33ae
--- /dev/null
@@ -0,0 +1,23 @@
+; RUN: opt < %s -inline -S | grep example
+
+       %IntArray = type { i32, [0 x i32*] }
+
+declare void @llvm.gcroot(i8**, i8*) nounwind 
+
+define i32 @f() {
+       %x = call i32 @g( )             ; <i32> [#uses=1]
+       ret i32 %x
+}
+
+define internal i32 @g() gc "example" {
+       %root = alloca i8*              ; <i8**> [#uses=2]
+       call void @llvm.gcroot( i8** %root, i8* null )
+       %obj = call %IntArray* @h( )            ; <%IntArray*> [#uses=2]
+       %obj.2 = bitcast %IntArray* %obj to i8*         ; <i8*> [#uses=1]
+       store i8* %obj.2, i8** %root
+       %Length.ptr = getelementptr %IntArray* %obj, i32 0, i32 0               ; <i32*> [#uses=1]
+       %Length = load i32* %Length.ptr         ; <i32> [#uses=1]
+       ret i32 %Length
+}
+
+declare %IntArray* @h()
diff --git a/test/CodeGen/X86/GC/inline2.ll b/test/CodeGen/X86/GC/inline2.ll
new file mode 100644 (file)
index 0000000..1594705
--- /dev/null
@@ -0,0 +1,24 @@
+; RUN: opt < %s -inline -S | grep sample
+; RUN: opt < %s -inline -S | grep example
+
+       %IntArray = type { i32, [0 x i32*] }
+
+declare void @llvm.gcroot(i8**, i8*) nounwind 
+
+define i32 @f() gc "sample" {
+       %x = call i32 @g( )             ; <i32> [#uses=1]
+       ret i32 %x
+}
+
+define internal i32 @g() gc "example" {
+       %root = alloca i8*              ; <i8**> [#uses=2]
+       call void @llvm.gcroot( i8** %root, i8* null )
+       %obj = call %IntArray* @h( )            ; <%IntArray*> [#uses=2]
+       %obj.2 = bitcast %IntArray* %obj to i8*         ; <i8*> [#uses=1]
+       store i8* %obj.2, i8** %root
+       %Length.ptr = getelementptr %IntArray* %obj, i32 0, i32 0               ; <i32*> [#uses=1]
+       %Length = load i32* %Length.ptr         ; <i32> [#uses=1]
+       ret i32 %Length
+}
+
+declare %IntArray* @h()
diff --git a/test/CodeGen/X86/GC/lower_gcroot.ll b/test/CodeGen/X86/GC/lower_gcroot.ll
new file mode 100644 (file)
index 0000000..c2d418a
--- /dev/null
@@ -0,0 +1,11 @@
+; RUN: llc < %s
+
+       %Env = type i8*
+
+define void @.main(%Env) gc "shadow-stack" {
+       %Root = alloca %Env
+       call void @llvm.gcroot( %Env* %Root, %Env null )
+       unreachable
+}
+
+declare void @llvm.gcroot(%Env*, %Env)
diff --git a/test/CodeGen/X86/GC/outside.ll b/test/CodeGen/X86/GC/outside.ll
new file mode 100644 (file)
index 0000000..2968c69
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: not llvm-as < %s >& /dev/null
+
+declare void @llvm.gcroot(i8**, i8*)
+
+define void @f(i8* %x) {
+       %root = alloca i8*
+       call void @llvm.gcroot(i8** %root, i8* null)
+       store i8* %x, i8** %root
+       ret void
+}
diff --git a/test/CodeGen/X86/GC/simple_ocaml.ll b/test/CodeGen/X86/GC/simple_ocaml.ll
new file mode 100644 (file)
index 0000000..f765dc0
--- /dev/null
@@ -0,0 +1,42 @@
+; RUN: llc < %s | grep caml.*__frametable
+; RUN: llc < %s -march=x86 | grep {movl        .0}
+
+%struct.obj = type { i8*, %struct.obj* }
+
+define %struct.obj* @fun(%struct.obj* %head) gc "ocaml" {
+entry:
+       %gcroot.0 = alloca i8*
+       %gcroot.1 = alloca i8*
+       
+       call void @llvm.gcroot(i8** %gcroot.0, i8* null)
+       call void @llvm.gcroot(i8** %gcroot.1, i8* null)
+       
+       %local.0 = bitcast i8** %gcroot.0 to %struct.obj**
+       %local.1 = bitcast i8** %gcroot.1 to %struct.obj**
+
+       store %struct.obj* %head, %struct.obj** %local.0
+       br label %bb.loop
+bb.loop:
+       %t0 = load %struct.obj** %local.0
+       %t1 = getelementptr %struct.obj* %t0, i32 0, i32 1
+       %t2 = bitcast %struct.obj* %t0 to i8*
+       %t3 = bitcast %struct.obj** %t1 to i8**
+       %t4 = call i8* @llvm.gcread(i8* %t2, i8** %t3)
+       %t5 = bitcast i8* %t4 to %struct.obj*
+       %t6 = icmp eq %struct.obj* %t5, null
+       br i1 %t6, label %bb.loop, label %bb.end
+bb.end:
+       %t7 = malloc %struct.obj
+       store %struct.obj* %t7, %struct.obj** %local.1
+       %t8 = bitcast %struct.obj* %t7 to i8*
+       %t9 = load %struct.obj** %local.0
+       %t10 = getelementptr %struct.obj* %t9, i32 0, i32 1
+       %t11 = bitcast %struct.obj* %t9 to i8*
+       %t12 = bitcast %struct.obj** %t10 to i8**
+       call void @llvm.gcwrite(i8* %t8, i8* %t11, i8** %t12)
+       ret %struct.obj* %t7
+}
+
+declare void @llvm.gcroot(i8** %value, i8* %tag)
+declare void @llvm.gcwrite(i8* %value, i8* %obj, i8** %field)
+declare i8* @llvm.gcread(i8* %obj, i8** %field)