diff options
Diffstat (limited to 'llvm/test/CodeGen/Generic/GC')
-rw-r--r-- | llvm/test/CodeGen/Generic/GC/badreadproto.ll | 13 | ||||
-rw-r--r-- | llvm/test/CodeGen/Generic/GC/badrootproto.ll | 13 | ||||
-rw-r--r-- | llvm/test/CodeGen/Generic/GC/badwriteproto.ll | 22 | ||||
-rw-r--r-- | llvm/test/CodeGen/Generic/GC/lower_gcroot.ll | 2 |
4 files changed, 49 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/Generic/GC/badreadproto.ll b/llvm/test/CodeGen/Generic/GC/badreadproto.ll new file mode 100644 index 00000000000..8568ba41d24 --- /dev/null +++ b/llvm/test/CodeGen/Generic/GC/badreadproto.ll @@ -0,0 +1,13 @@ +; RUN: not llvm-as < %s + + %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/llvm/test/CodeGen/Generic/GC/badrootproto.ll b/llvm/test/CodeGen/Generic/GC/badrootproto.ll new file mode 100644 index 00000000000..1b9d856c537 --- /dev/null +++ b/llvm/test/CodeGen/Generic/GC/badrootproto.ll @@ -0,0 +1,13 @@ +; RUN: not llvm-as < %s + + %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/llvm/test/CodeGen/Generic/GC/badwriteproto.ll b/llvm/test/CodeGen/Generic/GC/badwriteproto.ll new file mode 100644 index 00000000000..3682fc425b5 --- /dev/null +++ b/llvm/test/CodeGen/Generic/GC/badwriteproto.ll @@ -0,0 +1,22 @@ +; RUN: not llvm-as < %s + + %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/llvm/test/CodeGen/Generic/GC/lower_gcroot.ll b/llvm/test/CodeGen/Generic/GC/lower_gcroot.ll index 2dbbc83569f..4b0a17478f4 100644 --- a/llvm/test/CodeGen/Generic/GC/lower_gcroot.ll +++ b/llvm/test/CodeGen/Generic/GC/lower_gcroot.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | llc - %Env = type opaque* + %Env = type i8* define void @.main(%Env) { %Root = alloca %Env |