aboutsummaryrefslogtreecommitdiffstats
path: root/test/Linker
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2013-05-28 15:17:05 +0000
committerJames Molloy <james.molloy@arm.com>2013-05-28 15:17:05 +0000
commita84a83bbcdfaecadfc6574094272fd3edc429a23 (patch)
treeca87000d15263653ac635164ab194745b87f46e6 /test/Linker
parent9903f75bf6ec4136bd752595c689db845eedad3d (diff)
downloadexternal_llvm-a84a83bbcdfaecadfc6574094272fd3edc429a23.zip
external_llvm-a84a83bbcdfaecadfc6574094272fd3edc429a23.tar.gz
external_llvm-a84a83bbcdfaecadfc6574094272fd3edc429a23.tar.bz2
Extend RemapInstruction and friends to take an optional new parameter, a ValueMaterializer.
Extend LinkModules to pass a ValueMaterializer to RemapInstruction and friends to lazily create Functions for lazily linked globals. This is a big win when linking small modules with large (mostly unused) library modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Linker')
-rw-r--r--test/Linker/transitive-lazy-link.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Linker/transitive-lazy-link.ll b/test/Linker/transitive-lazy-link.ll
new file mode 100644
index 0000000..32b9d21
--- /dev/null
+++ b/test/Linker/transitive-lazy-link.ll
@@ -0,0 +1,15 @@
+; @f and @g are lazily linked. @f requires @g - ensure @g is correctly linked.
+
+; RUN: echo -e "declare i32 @f(i32)\ndefine i32 @h(i32 %x) {\n%1 = call i32 @f(i32 %x)\nret i32 %1\n}" | llvm-as >%t.1.bc
+; RUN: llvm-as < %s > %t.2.bc
+; RUN: llvm-link %t.1.bc %t.2.bc
+
+define available_externally i32 @f(i32 %x) {
+ %1 = call i32 @g(i32 %x)
+ ret i32 %1
+}
+
+define available_externally i32 @g(i32 %x) {
+ ret i32 5
+}
+