diff options
Diffstat (limited to 'test')
27 files changed, 126 insertions, 58 deletions
diff --git a/test/Assembler/2009-04-25-AliasGEP.ll b/test/Assembler/2009-04-25-AliasGEP.ll deleted file mode 100644 index 6d07208def..0000000000 --- a/test/Assembler/2009-04-25-AliasGEP.ll +++ /dev/null @@ -1,8 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis -; PR4066 -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:128:128" -target triple = "i386-apple-darwin9" - %struct.i2c_device_id = type { } -@w83l785ts_id = internal constant [0 x %struct.i2c_device_id] zeroinitializer, align 1 ; <[0 x %struct.i2c_device_id]*> [#uses=1] - -@__mod_i2c_device_table = alias getelementptr ([0 x %struct.i2c_device_id]* @w83l785ts_id, i32 0, i32 0) ; <%struct.i2c_device_id*> [#uses=0] diff --git a/test/Assembler/addrspacecast-alias.ll b/test/Assembler/addrspacecast-alias.ll index 6623a25d18..052a1414ea 100644 --- a/test/Assembler/addrspacecast-alias.ll +++ b/test/Assembler/addrspacecast-alias.ll @@ -1,6 +1,7 @@ -; RUN: llvm-as -disable-output %s +; RUN: llvm-as < %s | llvm-dis | FileCheck %s ; Test that global aliases are allowed to be constant addrspacecast @i = internal addrspace(1) global i8 42 -@ia = alias internal i8 addrspace(2)* addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)*) +@ia = alias internal addrspace(2) i8 addrspace(3)*, i8 addrspace(1)* @i +; CHECK: @ia = alias internal addrspace(2) i8 addrspace(3)*, i8 addrspace(1)* @i diff --git a/test/Assembler/alias-addrspace.ll b/test/Assembler/alias-addrspace.ll new file mode 100644 index 0000000000..6d378e45fa --- /dev/null +++ b/test/Assembler/alias-addrspace.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as %s 2>&1 | FileCheck %s + +@foo = global i32 42 +@bar = alias internal addrspace(1) i32* @foo + +CHECK: error: A type is required if addrspace is given diff --git a/test/Assembler/alias-to-alias.ll b/test/Assembler/alias-to-alias.ll new file mode 100644 index 0000000000..1ea99bbb69 --- /dev/null +++ b/test/Assembler/alias-to-alias.ll @@ -0,0 +1,5 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s +; CHECK: Alias must point to function or variable + +@b1 = alias i32* @c1 +@c1 = alias i32* @b1 diff --git a/test/Assembler/alias-to-alias2.ll b/test/Assembler/alias-to-alias2.ll new file mode 100644 index 0000000000..a8a0196f43 --- /dev/null +++ b/test/Assembler/alias-to-alias2.ll @@ -0,0 +1,7 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s +; CHECK: error: Alias is pointed by alias b1 + +@g = global i32 42 + +@b1 = alias i32* @c1 +@c1 = alias i32* @g diff --git a/test/Assembler/alias-type.ll b/test/Assembler/alias-type.ll new file mode 100644 index 0000000000..ead3e95243 --- /dev/null +++ b/test/Assembler/alias-type.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as %s 2>&1 | FileCheck %s + +@foo = global i32 42 +@bar = alias i32 @foo + +CHECK: error: An alias must have pointer type diff --git a/test/Bitcode/old-aliases.ll b/test/Bitcode/old-aliases.ll new file mode 100644 index 0000000000..4ef47c03dd --- /dev/null +++ b/test/Bitcode/old-aliases.ll @@ -0,0 +1,22 @@ +; RUN: llvm-dis < %s.bc | FileCheck %s + +; old-aliases.bc consist of this file assembled with an old llvm-as (3.5 trunk) +; from when aliases contained a ConstantExpr. + +@v1 = global i32 0 +; CHECK: @v1 = global i32 0 + +@v2 = global [1 x i32] zeroinitializer +; CHECK: @v2 = global [1 x i32] zeroinitializer + +@v3 = alias bitcast (i32* @v1 to i16*) +; CHECK: @v3 = alias i16, i32* @v1 + +@v4 = alias getelementptr ([1 x i32]* @v2, i32 0, i32 0) +; CHECK: @v4 = alias i32, [1 x i32]* @v2 + +@v5 = alias i32 addrspace(2)* addrspacecast (i32 addrspace(0)* @v1 to i32 addrspace(2)*) +; CHECK: @v5 = alias addrspace(2) i32, i32* @v1 + +@v6 = alias i16* @v3 +; CHECK: @v6 = alias i16, i32* @v1 diff --git a/test/Bitcode/old-aliases.ll.bc b/test/Bitcode/old-aliases.ll.bc Binary files differnew file mode 100644 index 0000000000..1f157b2a04 --- /dev/null +++ b/test/Bitcode/old-aliases.ll.bc diff --git a/test/CodeGen/ARM/aliases.ll b/test/CodeGen/ARM/aliases.ll index f55ae10b24..4de305b93b 100644 --- a/test/CodeGen/ARM/aliases.ll +++ b/test/CodeGen/ARM/aliases.ll @@ -29,7 +29,7 @@ define i32 @foo_f() { @bar_i = alias internal i32* @bar -@A = alias bitcast (i32* @bar to i64*) +@A = alias i64, i32* @bar define i32 @test() { entry: diff --git a/test/CodeGen/X86/aliases.ll b/test/CodeGen/X86/aliases.ll index d0a262d390..8487c6082b 100644 --- a/test/CodeGen/X86/aliases.ll +++ b/test/CodeGen/X86/aliases.ll @@ -22,7 +22,7 @@ define i32 @foo_f() { @bar_i = alias internal i32* @bar ; CHECK-DAG: .globl A -@A = alias bitcast (i32* @bar to i64*) +@A = alias i64, i32* @bar ; CHECK-DAG: .globl bar_h ; CHECK-DAG: .hidden bar_h diff --git a/test/CodeGen/X86/dllexport-x86_64.ll b/test/CodeGen/X86/dllexport-x86_64.ll index af0f85b00e..8bd882efee 100644 --- a/test/CodeGen/X86/dllexport-x86_64.ll +++ b/test/CodeGen/X86/dllexport-x86_64.ll @@ -66,7 +66,7 @@ define weak_odr dllexport void @weak1() { ; CHECK: .globl alias3 ; CHECK: alias3 = notExported -@alias3 = dllexport alias void()* @alias +@alias3 = dllexport alias void()* @notExported ; CHECK: .weak weak_alias ; CHECK: weak_alias = f1 diff --git a/test/CodeGen/X86/dllexport.ll b/test/CodeGen/X86/dllexport.ll index 6103a41211..b85df83e3e 100644 --- a/test/CodeGen/X86/dllexport.ll +++ b/test/CodeGen/X86/dllexport.ll @@ -85,7 +85,7 @@ define weak_odr dllexport void @weak1() { ; CHECK: .globl _alias3 ; CHECK: _alias3 = _notExported -@alias3 = dllexport alias void()* @alias +@alias3 = dllexport alias void()* @notExported ; CHECK: .weak _weak_alias ; CHECK: _weak_alias = _f1 diff --git a/test/Feature/alias2.ll b/test/Feature/alias2.ll new file mode 100644 index 0000000000..693ef7c9be --- /dev/null +++ b/test/Feature/alias2.ll @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +@v1 = global i32 0 +; CHECK: @v1 = global i32 0 + +@v2 = global [1 x i32] zeroinitializer +; CHECK: @v2 = global [1 x i32] zeroinitializer + +@v3 = alias i16, i32* @v1 +; CHECK: @v3 = alias i16, i32* @v1 + +@v4 = alias i32, [1 x i32]* @v2 +; CHECK: @v4 = alias i32, [1 x i32]* @v2 + +@v5 = alias addrspace(2) i32, i32* @v1 +; CHECK: @v5 = alias addrspace(2) i32, i32* @v1 + +@v6 = alias i16, i32* @v1 +; CHECK: @v6 = alias i16, i32* @v1 diff --git a/test/Feature/aliases.ll b/test/Feature/aliases.ll index 7fe9d0b374..b2ce82a838 100644 --- a/test/Feature/aliases.ll +++ b/test/Feature/aliases.ll @@ -7,7 +7,6 @@ @bar = global i32 0 @foo1 = alias i32* @bar @foo2 = alias i32* @bar -@foo3 = alias i32* @foo2 %FunTy = type i32() @@ -15,11 +14,10 @@ define i32 @foo_f() { ret i32 0 } @bar_f = alias weak_odr %FunTy* @foo_f -@bar_ff = alias i32()* @bar_f @bar_i = alias internal i32* @bar -@A = alias bitcast (i32* @bar to i64*) +@A = alias i64, i32* @bar define i32 @test() { entry: diff --git a/test/Linker/Inputs/PR8300.b.ll b/test/Linker/Inputs/PR8300.b.ll index 9e538f5d28..362d309a19 100644 --- a/test/Linker/Inputs/PR8300.b.ll +++ b/test/Linker/Inputs/PR8300.b.ll @@ -1,7 +1,7 @@ %foo = type { [8 x i8] } %bar = type { [9 x i8] } -@zed = alias bitcast (void (%bar*)* @xyz to void (%foo*)*) +@zed = alias void (%foo*), void (%bar*)* @xyz define void @xyz(%bar* %this) { entry: diff --git a/test/Linker/Inputs/alias.ll b/test/Linker/Inputs/alias.ll new file mode 100644 index 0000000000..b869cae71e --- /dev/null +++ b/test/Linker/Inputs/alias.ll @@ -0,0 +1,3 @@ +@zed = global i32 42 +@foo = alias i32* @zed +@foo2 = alias i16, i32* @zed diff --git a/test/Linker/Inputs/cycle.ll b/test/Linker/Inputs/cycle.ll new file mode 100644 index 0000000000..d0eddb6e7c --- /dev/null +++ b/test/Linker/Inputs/cycle.ll @@ -0,0 +1,2 @@ +@foo = alias i32* @bar +@bar = weak global i32 0 diff --git a/test/Linker/alias.ll b/test/Linker/alias.ll new file mode 100644 index 0000000000..5809a15082 --- /dev/null +++ b/test/Linker/alias.ll @@ -0,0 +1,16 @@ +; RUN: llvm-link %s %S/Inputs/alias.ll -S -o - | FileCheck %s +; RUN: llvm-link %S/Inputs/alias.ll %s -S -o - | FileCheck %s + +@foo = weak global i32 0 +; CHECK-DAG: @foo = alias i32* @zed + +@bar = alias i32* @foo +; CHECK-DAG: @bar = alias i32* @zed + +@foo2 = weak global i32 0 +; CHECK-DAG: @foo2 = alias i16, i32* @zed + +@bar2 = alias i32* @foo2 +; CHECK-DAG: @bar2 = alias i32* @zed + +; CHECK-DAG: @zed = global i32 42 diff --git a/test/Linker/cycle.ll b/test/Linker/cycle.ll new file mode 100644 index 0000000000..7d9ad2d9d6 --- /dev/null +++ b/test/Linker/cycle.ll @@ -0,0 +1,7 @@ +; RUN: not llvm-link %s %S/Inputs/cycle.ll 2>&1 | FileCheck %s +; RUN: not llvm-link %S/Inputs/cycle.ll %s 2>&1 | FileCheck %s + +; CHECK: Linking these modules creates an alias cycle + +@foo = weak global i32 0 +@bar = alias i32* @foo diff --git a/test/Other/extract-alias.ll b/test/Other/extract-alias.ll index d1e4af5456..dbc650ec69 100644 --- a/test/Other/extract-alias.ll +++ b/test/Other/extract-alias.ll @@ -14,7 +14,7 @@ ; DELETE: @zed = global i32 0 ; DELETE: @zeda0 = alias i32* @zed ; DELETE-NEXT: @a0foo = alias i32* ()* @foo -; DELETE-NEXT: @a0a0bar = alias void ()* @a0bar +; DELETE-NEXT: @a0a0bar = alias void ()* @bar ; DELETE-NEXT: @a0bar = alias void ()* @bar ; DELETE: declare i32* @foo() ; DELETE: define void @bar() { @@ -25,7 +25,7 @@ ; ALIAS: @zed = external global i32 ; ALIAS: @zeda0 = alias i32* @zed -; ALIASRE: @a0a0bar = alias void ()* @a0bar +; ALIASRE: @a0a0bar = alias void ()* @bar ; ALIASRE: @a0bar = alias void ()* @bar ; ALIASRE: declare void @bar() @@ -39,7 +39,7 @@ define i32* @foo() { ret i32* @zeda0 } -@a0a0bar = alias void ()* @a0bar +@a0a0bar = alias void ()* @bar @a0bar = alias void ()* @bar diff --git a/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll b/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll index 0bdced5114..4b967997ce 100644 --- a/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll +++ b/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll @@ -11,8 +11,8 @@ @L1 = alias i32* @A ; CHECK: @L1 = alias i32* @A -@L2 = alias internal i32* @L1 -; CHECK: @L2 = alias internal i32* @L1 +@L2 = alias internal i32* @A +; DEAD-NOT: @L2 -@L3 = alias i32* @L2 -; CHECK: @L3 = alias i32* @L2 +@L3 = alias i32* @A +; CHECK: @L3 = alias i32* @A diff --git a/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll b/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll index d6a565ad10..03d6ee4f8a 100644 --- a/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll +++ b/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll @@ -2,7 +2,7 @@ @g = global i32 0 -@a = alias bitcast (i32* @g to i8*) +@a = alias i8, i32* @g define void @f() { %tmp = load i8* @a diff --git a/test/Transforms/GlobalOpt/alias-resolve.ll b/test/Transforms/GlobalOpt/alias-resolve.ll index 2d5a956d14..bd07b31b23 100644 --- a/test/Transforms/GlobalOpt/alias-resolve.ll +++ b/test/Transforms/GlobalOpt/alias-resolve.ll @@ -1,9 +1,9 @@ ; RUN: opt < %s -globalopt -S | FileCheck %s -@foo1 = alias void ()* @foo2 +@foo1 = alias void ()* @bar2 ; CHECK: @foo1 = alias void ()* @bar2 -@foo2 = alias void()* @bar1 +@foo2 = alias void()* @bar2 ; CHECK: @foo2 = alias void ()* @bar2 @bar1 = alias void ()* @bar2 diff --git a/test/Transforms/InstCombine/bitcast-alias-function.ll b/test/Transforms/InstCombine/bitcast-alias-function.ll index a6b56f94ff..284960b113 100644 --- a/test/Transforms/InstCombine/bitcast-alias-function.ll +++ b/test/Transforms/InstCombine/bitcast-alias-function.ll @@ -6,46 +6,46 @@ target datalayout = "e-p:32:32:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16 ; Cases that should be bitcast ; Test cast between scalars with same bit sizes -@alias_i32_to_f32 = alias bitcast (i32 (i32)* @func_i32 to float (float)*) +@alias_i32_to_f32 = alias float (float), i32 (i32)* @func_i32 ; Test cast between vectors with same number of elements and bit sizes -@alias_v2i32_to_v2f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <2 x float> (<2 x float>)*) +@alias_v2i32_to_v2f32 = alias <2 x float> (<2 x float>), <2 x i32> (<2 x i32>)* @func_v2i32 ; Test cast from vector to scalar with same number of bits -@alias_v2f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <2 x float> (<2 x float>)*) +@alias_v2f32_to_i64 = alias <2 x float> (<2 x float>), i64 (i64)* @func_i64 ; Test cast from scalar to vector with same number of bits -@alias_i64_to_v2f32 = alias bitcast (<2 x float> (<2 x float>)* @func_v2f32 to i64 (i64)*) +@alias_i64_to_v2f32 = alias i64 (i64), <2 x float> (<2 x float>)* @func_v2f32 ; Test cast between vectors of pointers -@alias_v2i32p_to_v2i64p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to <2 x i64*> (<2 x i64*>)*) +@alias_v2i32p_to_v2i64p = alias <2 x i64*> (<2 x i64*>), <2 x i32*> (<2 x i32*>)* @func_v2i32p ; Cases that should be invalid and unchanged ; Test cast between scalars with different bit sizes -@alias_i64_to_f32 = alias bitcast (i64 (i64)* @func_i64 to float (float)*) +@alias_i64_to_f32 = alias float (float), i64 (i64)* @func_i64 ; Test cast between vectors with different bit sizes but the ; same number of elements -@alias_v2i64_to_v2f32 = alias bitcast (<2 x i64> (<2 x i64>)* @func_v2i64 to <2 x float> (<2 x float>)*) +@alias_v2i64_to_v2f32 = alias <2 x float> (<2 x float>), <2 x i64> (<2 x i64>)* @func_v2i64 ; Test cast between vectors with same number of bits and different ; numbers of elements -@alias_v2i32_to_v4f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <4 x float> (<4 x float>)*) +@alias_v2i32_to_v4f32 = alias <4 x float> (<4 x float>), <2 x i32> (<2 x i32>)* @func_v2i32 ; Test cast between scalar and vector with different number of bits -@alias_i64_to_v4f32 = alias bitcast (<4 x float> (<4 x float>)* @func_v4f32 to i64 (i64)*) +@alias_i64_to_v4f32 = alias i64 (i64), <4 x float> (<4 x float>)* @func_v4f32 ; Test cast between vector and scalar with different number of bits -@alias_v4f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x float> (<4 x float>)*) +@alias_v4f32_to_i64 = alias <4 x float> (<4 x float>), i64 (i64)* @func_i64 ; Test cast from scalar to vector of pointers with same number of bits ; We don't know the pointer size at this point, so this can't be done -@alias_i64_to_v2i32p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to i64 (i64)*) +@alias_i64_to_v2i32p = alias i64 (i64), <2 x i32*> (<2 x i32*>)* @func_v2i32p ; Test cast between vector of pointers and scalar with different number of bits -@alias_v4i32p_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x i32*> (<4 x i32*>)*) +@alias_v4i32p_to_i64 = alias <4 x i32*> (<4 x i32*>), i64 (i64)* @func_i64 diff --git a/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll b/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll index c71dbb1fd8..16bfe2a460 100644 --- a/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll +++ b/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll @@ -6,8 +6,8 @@ @B = alias i32* @A ; CHECK: @B = alias internal i32* @A -@C = alias i32* @B -; CHECK: @C = alias internal i32* @B +@C = alias i32* @A +; CHECK: @C = alias internal i32* @A define i32 @main() { %tmp = load i32* @C diff --git a/test/Verifier/aliasing-chain.ll b/test/Verifier/aliasing-chain.ll deleted file mode 100644 index ae0b77fdc3..0000000000 --- a/test/Verifier/aliasing-chain.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s -; CHECK: Aliasing chain should end with function or global variable -; Test that alising chain does not create a cycle - -@b1 = alias i32* @c1 -@c1 = alias i32* @b1 diff --git a/test/Verifier/bitcast-alias-address-space.ll b/test/Verifier/bitcast-alias-address-space.ll deleted file mode 100644 index d9794d9e33..0000000000 --- a/test/Verifier/bitcast-alias-address-space.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s - -; CHECK: error: invalid cast opcode for cast from 'i32 addrspace(2)*' to 'i32 addrspace(1)*' - -target datalayout = "e-p:32:32:32-p1:16:16:16-p2:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" - - -@data = addrspace(2) global i32 27 - -@illegal_alias_data = alias bitcast (i32 addrspace(2)* @data to i32 addrspace(1)*) |