diff options
Diffstat (limited to 'test/Other')
-rw-r--r-- | test/Other/FileCheck-space.txt | 9 | ||||
-rw-r--r-- | test/Other/Inputs/llvm-cov.gcda | bin | 0 -> 296 bytes | |||
-rw-r--r-- | test/Other/Inputs/llvm-cov.gcno | bin | 0 -> 984 bytes | |||
-rw-r--r-- | test/Other/ResponseFile.ll | 9 | ||||
-rw-r--r-- | test/Other/extract-alias.ll | 49 | ||||
-rw-r--r-- | test/Other/extract-weak-odr.ll | 23 | ||||
-rw-r--r-- | test/Other/extract.ll | 9 | ||||
-rw-r--r-- | test/Other/link-opts.ll | 13 | ||||
-rw-r--r-- | test/Other/lint.ll | 25 | ||||
-rw-r--r-- | test/Other/lit.local.cfg | 2 | ||||
-rw-r--r-- | test/Other/llvm-cov.test | 3 | ||||
-rw-r--r-- | test/Other/llvm-nm-without-aliases.ll | 25 | ||||
-rw-r--r-- | test/Other/spir_cc.ll | 13 |
13 files changed, 173 insertions, 7 deletions
diff --git a/test/Other/FileCheck-space.txt b/test/Other/FileCheck-space.txt new file mode 100644 index 0000000000000..6bbe5bc05ba75 --- /dev/null +++ b/test/Other/FileCheck-space.txt @@ -0,0 +1,9 @@ +RUN: printf "a\nb" | FileCheck %s -check-prefix=TEST1 +RUN: echo oo | FileCheck %s -check-prefix=TEST2 + +Check that CHECK-NEXT without a space after the colon works. +TEST1:a +TEST1-NEXT:b + +Check that CHECK-NOT without a space after the colon works. +TEST2-NOT:foo diff --git a/test/Other/Inputs/llvm-cov.gcda b/test/Other/Inputs/llvm-cov.gcda Binary files differnew file mode 100644 index 0000000000000..9ae2286ea2f4b --- /dev/null +++ b/test/Other/Inputs/llvm-cov.gcda diff --git a/test/Other/Inputs/llvm-cov.gcno b/test/Other/Inputs/llvm-cov.gcno Binary files differnew file mode 100644 index 0000000000000..25e202386a897 --- /dev/null +++ b/test/Other/Inputs/llvm-cov.gcno diff --git a/test/Other/ResponseFile.ll b/test/Other/ResponseFile.ll new file mode 100644 index 0000000000000..b8b3d0a902332 --- /dev/null +++ b/test/Other/ResponseFile.ll @@ -0,0 +1,9 @@ +; RUN: echo %s > %t.list +; RUN: llvm-as @%t.list -o %t.bc +; RUN: llvm-nm %t.bc 2>&1 | FileCheck %s + +; CHECK: T foobar + +define void @foobar() { + ret void +} diff --git a/test/Other/extract-alias.ll b/test/Other/extract-alias.ll new file mode 100644 index 0000000000000..d5bab4b3f36b3 --- /dev/null +++ b/test/Other/extract-alias.ll @@ -0,0 +1,49 @@ +; RUN: llvm-extract -func foo -S < %s | FileCheck %s +; RUN: llvm-extract -delete -func foo -S < %s | FileCheck --check-prefix=DELETE %s +; RUN: llvm-extract -alias zeda0 -S < %s | FileCheck --check-prefix=ALIAS %s +; RUN: llvm-extract -ralias .*bar -S < %s | FileCheck --check-prefix=ALIASRE %s + +; Both aliases should be converted to declarations +; CHECK: @zeda0 = external global i32 +; CHECK: define i32* @foo() { +; CHECK-NEXT: call void @a0bar() +; CHECK-NEXT: ret i32* @zeda0 +; CHECK-NEXT: } +; CHECK: declare void @a0bar() + +; DELETE: @zed = global i32 0 +; DELETE: @zeda0 = alias i32* @zed +; DELETE-NEXT: @a0foo = alias i32* ()* @foo +; DELETE-NEXT: @a0a0bar = alias void ()* @a0bar +; DELETE-NEXT: @a0bar = alias void ()* @bar +; DELETE: declare i32* @foo() +; DELETE: define void @bar() { +; DELETE-NEXT: %c = call i32* @foo() +; DELETE-NEXT: ret void +; DELETE-NEXT: } + +; ALIAS: @zed = external global i32 +; ALIAS: @zeda0 = alias i32* @zed + +; ALIASRE: @a0a0bar = alias void ()* @a0bar +; ALIASRE: @a0bar = alias void ()* @bar +; ALIASRE: declare void @bar() + +@zed = global i32 0 +@zeda0 = alias i32* @zed + +@a0foo = alias i32* ()* @foo + +define i32* @foo() { + call void @a0bar() + ret i32* @zeda0 +} + +@a0a0bar = alias void ()* @a0bar + +@a0bar = alias void ()* @bar + +define void @bar() { + %c = call i32* @foo() + ret void +} diff --git a/test/Other/extract-weak-odr.ll b/test/Other/extract-weak-odr.ll new file mode 100644 index 0000000000000..6618f58436451 --- /dev/null +++ b/test/Other/extract-weak-odr.ll @@ -0,0 +1,23 @@ +; RUN: llvm-extract -func foo -S < %s | FileCheck %s +; RUN: llvm-extract -delete -func foo -S < %s | FileCheck --check-prefix=DELETE %s + +; Test that we don't convert weak_odr to external definitions. + +; CHECK: @bar = external global i32 +; CHECK: define weak_odr i32* @foo() { +; CHECK-NEXT: ret i32* @bar +; CHECK-NEXT: } + +; DELETE: @bar = weak_odr global i32 42 +; DELETE: declare i32* @foo() + +@bar = weak_odr global i32 42 + +define weak_odr i32* @foo() { + ret i32* @bar +} + +define void @g() { + %c = call i32* @foo() + ret void +} diff --git a/test/Other/extract.ll b/test/Other/extract.ll index 57573ed76f9a9..8b0c835d57466 100644 --- a/test/Other/extract.ll +++ b/test/Other/extract.ll @@ -7,18 +7,19 @@ ; llvm-extract uses lazy bitcode loading, so make sure it correctly reads ; from bitcode files in addition to assembly files. -; CHECK: define void @foo() { +; CHECK: define hidden void @foo() { ; CHECK: ret void ; CHECK: } -; The linkonce_odr linkage for foo() should be changed to external linkage. -; DELETE: declare void @foo() +; The private linkage for foo() should be changed to external linkage and +; hidden visibility added. +; DELETE: declare hidden void @foo() ; DELETE: define void @bar() { ; DELETE: call void @foo() ; DELETE: ret void ; DELETE: } -define linkonce_odr void @foo() { +define private void @foo() { ret void } define void @bar() { diff --git a/test/Other/link-opts.ll b/test/Other/link-opts.ll new file mode 100644 index 0000000000000..8e58ac8a56837 --- /dev/null +++ b/test/Other/link-opts.ll @@ -0,0 +1,13 @@ +;RUN: opt -S -std-link-opts < %s | FileCheck %s +; Simple test to check that -std-link-opts keeps only the main function. + +; CHECK-NOT: define +; CHECK: define void @main +; CHECK-NOT: define +define void @main() { + ret void +} + +define void @foo() { + ret void +} diff --git a/test/Other/lint.ll b/test/Other/lint.ll index c84f56f8f694d..78bbbe9e6fa6e 100644 --- a/test/Other/lint.ll +++ b/test/Other/lint.ll @@ -9,8 +9,11 @@ declare void @has_noaliases(i32* noalias %p, i32* %q) declare void @one_arg(i32) @CG = constant i32 7 +@E = external global i8 define i32 @foo() noreturn { + %buf = alloca i8 + %buf2 = alloca {i8, i8}, align 2 ; CHECK: Caller and callee calling convention differ call void @bar() ; CHECK: Null pointer dereference @@ -26,8 +29,10 @@ define i32 @foo() noreturn { ; CHECK: Address one pointer dereference store i32 0, i32* inttoptr (i64 1 to i32*) ; CHECK: Memory reference address is misaligned - %x = inttoptr i32 1 to i32* - load i32* %x, align 4 + store i8 0, i8* %buf, align 2 +; CHECK: Memory reference address is misaligned + %gep = getelementptr {i8, i8}* %buf2, i32 0, i32 1 + store i8 0, i8* %gep, align 2 ; CHECK: Division by zero %sd = sdiv i32 2, 0 ; CHECK: Division by zero @@ -75,6 +80,18 @@ define i32 @foo() noreturn { ; CHECK: Write to read-only memory call void @llvm.memcpy.p0i8.p0i8.i64(i8* bitcast (i32* @CG to i8*), i8* bitcast (i32* @CG to i8*), i64 1, i32 1, i1 0) +; CHECK: Undefined behavior: Buffer overflow + %wider = bitcast i8* %buf to i16* + store i16 0, i16* %wider +; CHECK: Undefined behavior: Buffer overflow + %inner = getelementptr {i8, i8}* %buf2, i32 0, i32 1 + %wider2 = bitcast i8* %inner to i16* + store i16 0, i16* %wider2 +; CHECK: Undefined behavior: Buffer overflow + %before = getelementptr i8* %buf, i32 -1 + %wider3 = bitcast i8* %before to i16* + store i16 0, i16* %wider3 + br label %next next: @@ -84,6 +101,10 @@ next: ret i32 0 foo: +; CHECK-NOT: Undefined behavior: Buffer overflow +; CHECK-NOT: Memory reference address is misaligned + %e = bitcast i8* @E to i64* + store i64 0, i64* %e %z = add i32 0, 0 ; CHECK: unreachable immediately preceded by instruction without side effects unreachable diff --git a/test/Other/lit.local.cfg b/test/Other/lit.local.cfg index 19eebc0ac7ac3..269307724232d 100644 --- a/test/Other/lit.local.cfg +++ b/test/Other/lit.local.cfg @@ -1 +1 @@ -config.suffixes = ['.ll', '.c', '.cpp'] +config.suffixes = ['.ll', '.c', '.cpp', '.txt'] diff --git a/test/Other/llvm-cov.test b/test/Other/llvm-cov.test new file mode 100644 index 0000000000000..c0aa203e2c17a --- /dev/null +++ b/test/Other/llvm-cov.test @@ -0,0 +1,3 @@ +PR11760 +RUN: llvm-cov -gcda=%S/Inputs/llvm-cov.gcda -gcno=%S/Inputs/llvm-cov.gcno + diff --git a/test/Other/llvm-nm-without-aliases.ll b/test/Other/llvm-nm-without-aliases.ll new file mode 100644 index 0000000000000..9d9408c13b6df --- /dev/null +++ b/test/Other/llvm-nm-without-aliases.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s > %t +; RUN: llvm-nm -without-aliases < %t | FileCheck %s +; RUN: llvm-nm < %t | FileCheck --check-prefix=WITH %s + +; CHECK-NOT: T a0bar +; CHECK-NOT: T a0foo +; CHECK: T bar +; CHECK: T foo + +; WITH: T a0bar +; WITH: T a0foo +; WITH: T bar +; WITH: T foo + +@a0foo = alias void ()* @foo + +define void @foo() { + ret void +} + +@a0bar = alias void ()* @bar + +define void @bar() { + ret void +} diff --git a/test/Other/spir_cc.ll b/test/Other/spir_cc.ll new file mode 100644 index 0000000000000..ffc02945de4d2 --- /dev/null +++ b/test/Other/spir_cc.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llvm-dis > %t1.ll +; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll +; RUN: diff %t1.ll %t2.ll + +define spir_func void @foo() { + ret void +} + +define spir_kernel void @bar() { + call spir_func void @foo( ) + call spir_kernel void @bar( ) + ret void +} |