summaryrefslogtreecommitdiffstats
path: root/llvm/test/LTO/Resolution
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-09-14 21:07:32 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-09-14 21:07:32 +0000
commitecdab09bafa497d918878746cbc756dd23e7fdec (patch)
tree16ad61fbbfafaa485d763550fc44ae4dcc8ae117 /llvm/test/LTO/Resolution
parentb2f46d1dc7bb055fcbd647b07d0c441b8e69edc5 (diff)
downloadbcm5719-llvm-ecdab09bafa497d918878746cbc756dd23e7fdec.tar.gz
bcm5719-llvm-ecdab09bafa497d918878746cbc756dd23e7fdec.zip
[LTO] Move tests from test/tools to test/LTO, as they're testing the API functionalities (NFC)
llvm-svn: 281539
Diffstat (limited to 'llvm/test/LTO/Resolution')
-rw-r--r--llvm/test/LTO/Resolution/X86/Inputs/common2.ll7
-rw-r--r--llvm/test/LTO/Resolution/X86/common2.ll89
2 files changed, 96 insertions, 0 deletions
diff --git a/llvm/test/LTO/Resolution/X86/Inputs/common2.ll b/llvm/test/LTO/Resolution/X86/Inputs/common2.ll
new file mode 100644
index 00000000000..577e9977ac0
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/Inputs/common2.ll
@@ -0,0 +1,7 @@
+target triple = "x86_64-apple-macosx10.11.0"
+
+@v = common global i16 0, align 4
+
+define i16 *@bar() {
+ ret i16 *@v
+} \ No newline at end of file
diff --git a/llvm/test/LTO/Resolution/X86/common2.ll b/llvm/test/LTO/Resolution/X86/common2.ll
new file mode 100644
index 00000000000..4a6c95b7a14
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/common2.ll
@@ -0,0 +1,89 @@
+; RUN: llvm-as < %s > %t1.bc
+; RUN: llvm-as < %p/Inputs/common2.ll > %t2.bc
+
+; Test that the common merging (size + alignment) is properly handled
+
+; Client marked the "large with little alignment" one as prevailing
+; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,x \
+; RUN: -r %t2.bc,v,px \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=LARGE-PREVAILED
+
+; Same as before, but reversing the order of the inputs
+; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,x \
+; RUN: -r %t2.bc,v,px \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=LARGE-PREVAILED
+
+; Client marked the "small with large alignment" one as prevailing
+; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,px \
+; RUN: -r %t2.bc,v,x \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=SMALL-PREVAILED
+
+; Same as before, but reversing the order of the inputs
+; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,px \
+; RUN: -r %t2.bc,v,x \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=SMALL-PREVAILED
+
+
+; Client didn't mark any as prevailing, we keep the first one we see as "external"
+; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,x \
+; RUN: -r %t2.bc,v,x \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=NONE-PREVAILED1
+
+; Same as before, but reversing the order of the inputs
+; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,x \
+; RUN: -r %t2.bc,v,x \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=NONE-PREVAILED2
+
+
+
+; Client marked both as prevailing
+; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,px \
+; RUN: -r %t2.bc,v,px \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=BOTH-PREVAILED1
+
+; Same as before, but reversing the order of the inputs
+; RUN: llvm-lto2 %t2.bc %t1.bc -o %t.o -save-temps \
+; RUN: -r %t1.bc,v,px \
+; RUN: -r %t2.bc,v,px \
+; RUN: -r %t1.bc,foo,px \
+; RUN: -r %t2.bc,bar,px
+; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=BOTH-PREVAILED2
+
+
+
+target triple = "x86_64-apple-macosx10.11.0"
+
+@v = common global i8 0, align 8
+
+; LARGE-PREVAILED: @v = common global i16 0, align 8
+; SMALL-PREVAILED: @v = common global [2 x i8] zeroinitializer, align 8
+; BOTH-PREVAILED1: @v = common global i16 0, align 8
+; BOTH-PREVAILED2: common global [2 x i8] zeroinitializer, align 8
+; In this case the first is kept as external
+; NONE-PREVAILED1: @v = external global i8, align 8
+; NONE-PREVAILED2: @v = external global i16, align 4
+
+define i8 *@foo() {
+ ret i8 *@v
+}
OpenPOWER on IntegriCloud