summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-04-23 23:29:24 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-04-23 23:29:24 +0000
commitcb87494f4cbd4769c6769a752c2c9fb5c4e1bb00 (patch)
treeccba1197f36aeb02314de5e91facc38830f5d4e6 /llvm/test
parent0d7f43ea7cb3a84251f3e536caaec420dfb8214f (diff)
downloadbcm5719-llvm-cb87494f4cbd4769c6769a752c2c9fb5c4e1bb00.tar.gz
bcm5719-llvm-cb87494f4cbd4769c6769a752c2c9fb5c4e1bb00.zip
Always traverse GlobalVariable initializer when computing the export list
Summary: We are always importing the initializer for a GlobalVariable. So if a GlobalVariable is in the export-list, we pull in any refs as well. Reviewers: tejohnson Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19102 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267303
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll16
-rw-r--r--llvm/test/ThinLTO/X86/referenced_by_constant.ll21
2 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll b/llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll
new file mode 100644
index 00000000000..12b179bcd0e
--- /dev/null
+++ b/llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll
@@ -0,0 +1,16 @@
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.11.0"
+
+define void @referencedbyglobal() {
+ ret void
+}
+
+@someglobal = internal unnamed_addr constant i8* bitcast (void ()* @referencedbyglobal to i8*)
+@ptr = global i8** null
+
+define void @bar() #0 align 2 {
+ store i8** getelementptr inbounds (i8*, i8** @someglobal, i64 0) , i8*** @ptr, align 8
+ ret void
+}
+
diff --git a/llvm/test/ThinLTO/X86/referenced_by_constant.ll b/llvm/test/ThinLTO/X86/referenced_by_constant.ll
new file mode 100644
index 00000000000..6c3112a40fe
--- /dev/null
+++ b/llvm/test/ThinLTO/X86/referenced_by_constant.ll
@@ -0,0 +1,21 @@
+; Do setup work for all below tests: generate bitcode and combined index
+; RUN: opt -module-summary %s -o %t.bc
+; RUN: opt -module-summary %p/Inputs/referenced_by_constant.ll -o %t2.bc
+; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %t2.bc
+
+; Check the import side: we import bar() and @someglobal, but not @referencedbyglobal()
+; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
+; IMPORT: @someglobal.llvm.0 =
+; IMPORT: define available_externally void @bar()
+; IMPORT: declare void @referencedbyglobal()
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.11.0"
+
+declare void @bar()
+
+define void @foo() {
+ call void @bar()
+ ret void
+}
+
OpenPOWER on IntegriCloud