diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Assembler/addrspacecast-alias.ll | 4 | ||||
-rw-r--r-- | test/Assembler/alias-addrspace.ll | 6 | ||||
-rw-r--r-- | test/Assembler/alias-to-alias.ll | 5 | ||||
-rw-r--r-- | test/Assembler/alias-to-alias2.ll | 7 | ||||
-rw-r--r-- | test/Assembler/alias-type.ll | 6 | ||||
-rw-r--r-- | test/Bitcode/old-aliases.ll | 8 | ||||
-rw-r--r-- | test/CodeGen/ARM/aliases.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/X86/aliases.ll | 15 | ||||
-rw-r--r-- | test/CodeGen/X86/dllexport-x86_64.ll | 2 | ||||
-rw-r--r-- | test/Feature/alias2.ll | 22 | ||||
-rw-r--r-- | test/Feature/aliases.ll | 4 | ||||
-rw-r--r-- | test/Linker/Inputs/PR8300.b.ll | 2 | ||||
-rw-r--r-- | test/Linker/Inputs/alias.ll | 2 | ||||
-rw-r--r-- | test/Linker/Inputs/cycle.ll | 2 | ||||
-rw-r--r-- | test/Linker/alias.ll | 6 | ||||
-rw-r--r-- | test/Linker/cycle.ll | 7 | ||||
-rw-r--r-- | test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll | 8 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll | 2 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/alias-resolve.ll | 4 | ||||
-rw-r--r-- | test/Transforms/InstCombine/bitcast-alias-function.ll | 24 | ||||
-rw-r--r-- | test/Verifier/alias.ll | 15 | ||||
-rw-r--r-- | test/Verifier/bitcast-alias-address-space.ll | 10 |
22 files changed, 88 insertions, 75 deletions
diff --git a/test/Assembler/addrspacecast-alias.ll b/test/Assembler/addrspacecast-alias.ll index 052a1414ea..7d00ac4f8f 100644 --- a/test/Assembler/addrspacecast-alias.ll +++ b/test/Assembler/addrspacecast-alias.ll @@ -3,5 +3,5 @@ ; Test that global aliases are allowed to be constant addrspacecast @i = internal addrspace(1) global i8 42 -@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 +@ia = alias internal addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*) +; CHECK: @ia = alias internal addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*) diff --git a/test/Assembler/alias-addrspace.ll b/test/Assembler/alias-addrspace.ll deleted file mode 100644 index 6d378e45fa..0000000000 --- a/test/Assembler/alias-addrspace.ll +++ /dev/null @@ -1,6 +0,0 @@ -; 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 deleted file mode 100644 index 1ea99bbb69..0000000000 --- a/test/Assembler/alias-to-alias.ll +++ /dev/null @@ -1,5 +0,0 @@ -; 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 deleted file mode 100644 index a8a0196f43..0000000000 --- a/test/Assembler/alias-to-alias2.ll +++ /dev/null @@ -1,7 +0,0 @@ -; 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 deleted file mode 100644 index ead3e95243..0000000000 --- a/test/Assembler/alias-type.ll +++ /dev/null @@ -1,6 +0,0 @@ -; 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 index 4ef47c03dd..7a0eea2f3f 100644 --- a/test/Bitcode/old-aliases.ll +++ b/test/Bitcode/old-aliases.ll @@ -10,13 +10,13 @@ ; CHECK: @v2 = global [1 x i32] zeroinitializer @v3 = alias bitcast (i32* @v1 to i16*) -; CHECK: @v3 = alias i16, i32* @v1 +; CHECK: @v3 = alias bitcast (i32* @v1 to i16*) @v4 = alias getelementptr ([1 x i32]* @v2, i32 0, i32 0) -; CHECK: @v4 = alias i32, [1 x i32]* @v2 +; CHECK: @v4 = alias getelementptr inbounds ([1 x i32]* @v2, i32 0, i32 0) @v5 = alias i32 addrspace(2)* addrspacecast (i32 addrspace(0)* @v1 to i32 addrspace(2)*) -; CHECK: @v5 = alias addrspace(2) i32, i32* @v1 +; CHECK: @v5 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*) @v6 = alias i16* @v3 -; CHECK: @v6 = alias i16, i32* @v1 +; CHECK: @v6 = alias i16* @v3 diff --git a/test/CodeGen/ARM/aliases.ll b/test/CodeGen/ARM/aliases.ll index 4de305b93b..f55ae10b24 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 i64, i32* @bar +@A = alias bitcast (i32* @bar to i64*) define i32 @test() { entry: diff --git a/test/CodeGen/X86/aliases.ll b/test/CodeGen/X86/aliases.ll index d207880d66..bf55644de4 100644 --- a/test/CodeGen/X86/aliases.ll +++ b/test/CodeGen/X86/aliases.ll @@ -38,7 +38,7 @@ define i32 @foo_f() { @bar_i = alias internal i32* @bar ; CHECK-DAG: .globl A -@A = alias i64, i32* @bar +@A = alias bitcast (i32* @bar to i64*) ; CHECK-DAG: .globl bar_h ; CHECK-DAG: .hidden bar_h @@ -48,6 +48,19 @@ define i32 @foo_f() { ; CHECK-DAG: .protected bar_p @bar_p = protected alias i32* @bar +; CHECK-DAG: test2 = bar+4 +@test2 = alias getelementptr(i32 *@bar, i32 1) + +; CHECK-DAG: test3 = 42 +@test3 = alias inttoptr(i32 42 to i32*) + +; CHECK-DAG: test4 = bar +@test4 = alias inttoptr(i64 ptrtoint (i32* @bar to i64) to i32*) + +; CHECK-DAG: test5 = test2-bar +@test5 = alias inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32), + i32 ptrtoint (i32* @bar to i32)) to i32*) + ; CHECK-DAG: .globl test define i32 @test() { entry: diff --git a/test/CodeGen/X86/dllexport-x86_64.ll b/test/CodeGen/X86/dllexport-x86_64.ll index f4dec4ff59..0d5afa1b13 100644 --- a/test/CodeGen/X86/dllexport-x86_64.ll +++ b/test/CodeGen/X86/dllexport-x86_64.ll @@ -73,7 +73,7 @@ define weak_odr dllexport void @weak1() { @weak_alias = dllexport alias weak_odr void()* @f1 @blob = global [6 x i8] c"\B8*\00\00\00\C3", section ".text", align 16 -@blob_alias = dllexport alias i32 (), [6 x i8]* @blob +@blob_alias = dllexport alias bitcast ([6 x i8]* @blob to i32 ()*) ; CHECK: .section .drectve ; WIN32: " /EXPORT:Var1,DATA" diff --git a/test/Feature/alias2.ll b/test/Feature/alias2.ll index bc542ffd77..73c874f2b9 100644 --- a/test/Feature/alias2.ll +++ b/test/Feature/alias2.ll @@ -6,17 +6,23 @@ @v2 = global [1 x i32] zeroinitializer ; CHECK: @v2 = global [1 x i32] zeroinitializer -@a1 = alias i16, i32* @v1 -; CHECK: @a1 = alias i16, i32* @v1 +@v3 = global [2 x i16] zeroinitializer +; CHECK: @v3 = global [2 x i16] zeroinitializer -@a2 = alias i32, [1 x i32]* @v2 -; CHECK: @a2 = alias i32, [1 x i32]* @v2 +@a1 = alias bitcast (i32* @v1 to i16*) +; CHECK: @a1 = alias bitcast (i32* @v1 to i16*) -@a3 = alias addrspace(2) i32, i32* @v1 -; CHECK: @a3 = alias addrspace(2) i32, i32* @v1 +@a2 = alias bitcast([1 x i32]* @v2 to i32*) +; CHECK: @a2 = alias getelementptr inbounds ([1 x i32]* @v2, i32 0, i32 0) -@a4 = alias i16, i32* @v1 -; CHECK: @a4 = alias i16, i32* @v1 +@a3 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*) +; CHECK: @a3 = alias addrspacecast (i32* @v1 to i32 addrspace(2)*) + +@a4 = alias bitcast (i32* @v1 to i16*) +; CHECK: @a4 = alias bitcast (i32* @v1 to i16*) @a5 = thread_local(localdynamic) alias i32* @v1 ; CHECK: @a5 = thread_local(localdynamic) alias i32* @v1 + +@a6 = alias getelementptr ([2 x i16]* @v3, i32 1, i32 1) +; CHECK: @a6 = alias getelementptr ([2 x i16]* @v3, i32 1, i32 1) diff --git a/test/Feature/aliases.ll b/test/Feature/aliases.ll index b2ce82a838..7fe9d0b374 100644 --- a/test/Feature/aliases.ll +++ b/test/Feature/aliases.ll @@ -7,6 +7,7 @@ @bar = global i32 0 @foo1 = alias i32* @bar @foo2 = alias i32* @bar +@foo3 = alias i32* @foo2 %FunTy = type i32() @@ -14,10 +15,11 @@ 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 i64, i32* @bar +@A = alias bitcast (i32* @bar to i64*) define i32 @test() { entry: diff --git a/test/Linker/Inputs/PR8300.b.ll b/test/Linker/Inputs/PR8300.b.ll index 362d309a19..9e538f5d28 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 void (%foo*), void (%bar*)* @xyz +@zed = alias bitcast (void (%bar*)* @xyz to void (%foo*)*) define void @xyz(%bar* %this) { entry: diff --git a/test/Linker/Inputs/alias.ll b/test/Linker/Inputs/alias.ll index b869cae71e..f379476e76 100644 --- a/test/Linker/Inputs/alias.ll +++ b/test/Linker/Inputs/alias.ll @@ -1,3 +1,3 @@ @zed = global i32 42 @foo = alias i32* @zed -@foo2 = alias i16, i32* @zed +@foo2 = alias bitcast (i32* @zed to i16*) diff --git a/test/Linker/Inputs/cycle.ll b/test/Linker/Inputs/cycle.ll deleted file mode 100644 index d0eddb6e7c..0000000000 --- a/test/Linker/Inputs/cycle.ll +++ /dev/null @@ -1,2 +0,0 @@ -@foo = alias i32* @bar -@bar = weak global i32 0 diff --git a/test/Linker/alias.ll b/test/Linker/alias.ll index 5809a15082..bce51ad983 100644 --- a/test/Linker/alias.ll +++ b/test/Linker/alias.ll @@ -5,12 +5,12 @@ ; CHECK-DAG: @foo = alias i32* @zed @bar = alias i32* @foo -; CHECK-DAG: @bar = alias i32* @zed +; CHECK-DAG: @bar = alias i32* @foo @foo2 = weak global i32 0 -; CHECK-DAG: @foo2 = alias i16, i32* @zed +; CHECK-DAG: @foo2 = alias bitcast (i32* @zed to i16*) @bar2 = alias i32* @foo2 -; CHECK-DAG: @bar2 = alias i32* @zed +; CHECK-DAG: @bar2 = alias bitcast (i16* @foo2 to i32*) ; CHECK-DAG: @zed = global i32 42 diff --git a/test/Linker/cycle.ll b/test/Linker/cycle.ll deleted file mode 100644 index 7d9ad2d9d6..0000000000 --- a/test/Linker/cycle.ll +++ /dev/null @@ -1,7 +0,0 @@ -; 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/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll b/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll index 4b967997ce..0bdced5114 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* @A -; DEAD-NOT: @L2 +@L2 = alias internal i32* @L1 +; CHECK: @L2 = alias internal i32* @L1 -@L3 = alias i32* @A -; CHECK: @L3 = alias i32* @A +@L3 = alias i32* @L2 +; CHECK: @L3 = alias i32* @L2 diff --git a/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll b/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll index 03d6ee4f8a..d6a565ad10 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 i8, i32* @g +@a = alias bitcast (i32* @g to i8*) define void @f() { %tmp = load i8* @a diff --git a/test/Transforms/GlobalOpt/alias-resolve.ll b/test/Transforms/GlobalOpt/alias-resolve.ll index bd07b31b23..2d5a956d14 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 ()* @bar2 +@foo1 = alias void ()* @foo2 ; CHECK: @foo1 = alias void ()* @bar2 -@foo2 = alias void()* @bar2 +@foo2 = alias void()* @bar1 ; 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 284960b113..a6b56f94ff 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 float (float), i32 (i32)* @func_i32 +@alias_i32_to_f32 = alias bitcast (i32 (i32)* @func_i32 to float (float)*) ; Test cast between vectors with same number of elements and bit sizes -@alias_v2i32_to_v2f32 = alias <2 x float> (<2 x float>), <2 x i32> (<2 x i32>)* @func_v2i32 +@alias_v2i32_to_v2f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <2 x float> (<2 x float>)*) ; Test cast from vector to scalar with same number of bits -@alias_v2f32_to_i64 = alias <2 x float> (<2 x float>), i64 (i64)* @func_i64 +@alias_v2f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <2 x float> (<2 x float>)*) ; Test cast from scalar to vector with same number of bits -@alias_i64_to_v2f32 = alias i64 (i64), <2 x float> (<2 x float>)* @func_v2f32 +@alias_i64_to_v2f32 = alias bitcast (<2 x float> (<2 x float>)* @func_v2f32 to i64 (i64)*) ; Test cast between vectors of pointers -@alias_v2i32p_to_v2i64p = alias <2 x i64*> (<2 x i64*>), <2 x i32*> (<2 x i32*>)* @func_v2i32p +@alias_v2i32p_to_v2i64p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to <2 x i64*> (<2 x i64*>)*) ; Cases that should be invalid and unchanged ; Test cast between scalars with different bit sizes -@alias_i64_to_f32 = alias float (float), i64 (i64)* @func_i64 +@alias_i64_to_f32 = alias bitcast (i64 (i64)* @func_i64 to float (float)*) ; Test cast between vectors with different bit sizes but the ; same number of elements -@alias_v2i64_to_v2f32 = alias <2 x float> (<2 x float>), <2 x i64> (<2 x i64>)* @func_v2i64 +@alias_v2i64_to_v2f32 = alias bitcast (<2 x i64> (<2 x i64>)* @func_v2i64 to <2 x float> (<2 x float>)*) ; Test cast between vectors with same number of bits and different ; numbers of elements -@alias_v2i32_to_v4f32 = alias <4 x float> (<4 x float>), <2 x i32> (<2 x i32>)* @func_v2i32 +@alias_v2i32_to_v4f32 = alias bitcast (<2 x i32> (<2 x i32>)* @func_v2i32 to <4 x float> (<4 x float>)*) ; Test cast between scalar and vector with different number of bits -@alias_i64_to_v4f32 = alias i64 (i64), <4 x float> (<4 x float>)* @func_v4f32 +@alias_i64_to_v4f32 = alias bitcast (<4 x float> (<4 x float>)* @func_v4f32 to i64 (i64)*) ; Test cast between vector and scalar with different number of bits -@alias_v4f32_to_i64 = alias <4 x float> (<4 x float>), i64 (i64)* @func_i64 +@alias_v4f32_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x float> (<4 x float>)*) ; 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 i64 (i64), <2 x i32*> (<2 x i32*>)* @func_v2i32p +@alias_i64_to_v2i32p = alias bitcast (<2 x i32*> (<2 x i32*>)* @func_v2i32p to i64 (i64)*) ; Test cast between vector of pointers and scalar with different number of bits -@alias_v4i32p_to_i64 = alias <4 x i32*> (<4 x i32*>), i64 (i64)* @func_i64 +@alias_v4i32p_to_i64 = alias bitcast (i64 (i64)* @func_i64 to <4 x i32*> (<4 x i32*>)*) diff --git a/test/Verifier/alias.ll b/test/Verifier/alias.ll index e3636bc701..ff02a37bab 100644 --- a/test/Verifier/alias.ll +++ b/test/Verifier/alias.ll @@ -10,3 +10,18 @@ declare void @f() @ga = alias i32* @g ; CHECK: Alias must point to a definition ; CHECK-NEXT: @ga + + +@test2_a = alias i32* @test2_b +@test2_b = alias i32* @test2_a +; CHECK: Aliases cannot form a cycle +; CHECK-NEXT: i32* @test2_a +; CHECK-NEXT: Aliases cannot form a cycle +; CHECK-NEXT: i32* @test2_b + + +@test3_a = global i32 42 +@test3_b = alias weak i32* @test3_a +@test3_c = alias i32* @test3_b +; CHECK: Alias cannot point to a weak alias +; CHECK-NEXT: i32* @test3_c diff --git a/test/Verifier/bitcast-alias-address-space.ll b/test/Verifier/bitcast-alias-address-space.ll new file mode 100644 index 0000000000..d9794d9e33 --- /dev/null +++ b/test/Verifier/bitcast-alias-address-space.ll @@ -0,0 +1,10 @@ +; 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)*) |