summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-29 20:43:47 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-29 20:43:47 +0000
commit5a0a2e648c267d99111b21482ca709f580e9ccc2 (patch)
treeabf66eb720a1053fb9b82367df3087dcc61c6b2e /llvm/test/Bitcode
parentd34c26eb08fb783b0bcb52d5410cfbd5cf32757b (diff)
downloadbcm5719-llvm-5a0a2e648c267d99111b21482ca709f580e9ccc2.tar.gz
bcm5719-llvm-5a0a2e648c267d99111b21482ca709f580e9ccc2.zip
Bitcode: Introduce BitcodeWriter interface.
This interface allows clients to write multiple modules to a single bitcode file. Also introduce the llvm-cat utility which can be used to create a bitcode file containing multiple modules. Differential Revision: https://reviews.llvm.org/D26179 llvm-svn: 288195
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r--llvm/test/Bitcode/Inputs/multi-module.ll3
-rw-r--r--llvm/test/Bitcode/multi-module.ll39
2 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/Inputs/multi-module.ll b/llvm/test/Bitcode/Inputs/multi-module.ll
new file mode 100644
index 00000000000..e4e9b82be64
--- /dev/null
+++ b/llvm/test/Bitcode/Inputs/multi-module.ll
@@ -0,0 +1,3 @@
+define void @f2() {
+ ret void
+}
diff --git a/llvm/test/Bitcode/multi-module.ll b/llvm/test/Bitcode/multi-module.ll
new file mode 100644
index 00000000000..a6c25c7cdbe
--- /dev/null
+++ b/llvm/test/Bitcode/multi-module.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-cat -o %t %s %S/Inputs/multi-module.ll
+; RUN: not llvm-dis -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
+; ERROR: Expected a single module
+
+; FIXME: Introduce a tool for extracting modules from bitcode and use it here.
+; For now we can at least check that the bitcode contains multiple modules.
+; RUN: llvm-bcanalyzer -dump %t | FileCheck --check-prefix=BCA %s
+
+; RUN: llvm-as -o %t1 %s
+; RUN: llvm-as -o %t2 %S/Inputs/multi-module.ll
+; RUN: llvm-cat -o %t %t1 %t2
+; RUN: not llvm-dis -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
+; RUN: llvm-bcanalyzer -dump %t | FileCheck --check-prefix=BCA %s
+
+; RUN: llvm-cat -b -o %t %t1 %t2
+; RUN: not llvm-dis -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
+; RUN: llvm-bcanalyzer -dump %t | FileCheck --check-prefix=BCA %s
+
+; RUN: llvm-cat -b -o %t3 %t %t
+; RUN: not llvm-dis -o - %t3 2>&1 | FileCheck --check-prefix=ERROR %s
+; RUN: llvm-bcanalyzer -dump %t3 | FileCheck --check-prefix=BCA4 %s
+
+; BCA: <IDENTIFICATION_BLOCK
+; BCA: <MODULE_BLOCK
+; BCA: <IDENTIFICATION_BLOCK
+; BCA: <MODULE_BLOCK
+
+; BCA4: <IDENTIFICATION_BLOCK
+; BCA4: <MODULE_BLOCK
+; BCA4: <IDENTIFICATION_BLOCK
+; BCA4: <MODULE_BLOCK
+; BCA4: <IDENTIFICATION_BLOCK
+; BCA4: <MODULE_BLOCK
+; BCA4: <IDENTIFICATION_BLOCK
+; BCA4: <MODULE_BLOCK
+
+define void @f1() {
+ ret void
+}
OpenPOWER on IntegriCloud