From 392be58cad0f051b4e7e252b44cef14b547f9b81 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 12 Feb 2010 20:49:41 +0000 Subject: Add support for a union type in LLVM IR. Patch by Talin! llvm-svn: 96011 --- llvm/test/Assembler/2010-01-06-UnionType.ll | 3 +++ llvm/test/Feature/unions.ll | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 llvm/test/Assembler/2010-01-06-UnionType.ll create mode 100644 llvm/test/Feature/unions.ll (limited to 'llvm/test') diff --git a/llvm/test/Assembler/2010-01-06-UnionType.ll b/llvm/test/Assembler/2010-01-06-UnionType.ll new file mode 100644 index 00000000000..37130d66088 --- /dev/null +++ b/llvm/test/Assembler/2010-01-06-UnionType.ll @@ -0,0 +1,3 @@ +; RUN: llvm-as %s -o /dev/null + +%X = type union { i32, i32* } diff --git a/llvm/test/Feature/unions.ll b/llvm/test/Feature/unions.ll new file mode 100644 index 00000000000..9d6c36bb3c5 --- /dev/null +++ b/llvm/test/Feature/unions.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llvm-dis > %t1.ll +; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll +; RUN: diff %t1.ll %t2.ll + +%union.anon = type union { i8, i32, float } + +@union1 = constant union { i32, i8 } { i32 4 } +@union2 = constant union { i32, i8 } insertvalue(union { i32, i8 } undef, i32 4, 0) + +define void @"Unions" () { + ret void +} -- cgit v1.2.3