summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/gold
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-06-09 01:14:13 +0000
committerTeresa Johnson <tejohnson@google.com>2016-06-09 01:14:13 +0000
commit7ab1f692720ce4ac024ff5bc0decd69c15389edb (patch)
tree29f39550f640752991c9af431bc38384947bce87 /llvm/test/tools/gold
parent1eade9151310d1ca8fd18e932c9af2f8c1ac2f94 (diff)
downloadbcm5719-llvm-7ab1f692720ce4ac024ff5bc0decd69c15389edb.tar.gz
bcm5719-llvm-7ab1f692720ce4ac024ff5bc0decd69c15389edb.zip
[ThinLTO/gold] Enable summary-based internalization
Summary: Enable existing summary-based importing support in the gold-plugin. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D21080 llvm-svn: 272239
Diffstat (limited to 'llvm/test/tools/gold')
-rw-r--r--llvm/test/tools/gold/X86/Inputs/thinlto_alias.ll4
-rw-r--r--llvm/test/tools/gold/X86/Inputs/thinlto_internalize.ll6
-rw-r--r--llvm/test/tools/gold/X86/thinlto_alias.ll30
-rw-r--r--llvm/test/tools/gold/X86/thinlto_internalize.ll21
-rw-r--r--llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll1
5 files changed, 62 insertions, 0 deletions
diff --git a/llvm/test/tools/gold/X86/Inputs/thinlto_alias.ll b/llvm/test/tools/gold/X86/Inputs/thinlto_alias.ll
new file mode 100644
index 00000000000..594c6d3a192
--- /dev/null
+++ b/llvm/test/tools/gold/X86/Inputs/thinlto_alias.ll
@@ -0,0 +1,4 @@
+define weak void @weakfunc() {
+entry:
+ ret void
+}
diff --git a/llvm/test/tools/gold/X86/Inputs/thinlto_internalize.ll b/llvm/test/tools/gold/X86/Inputs/thinlto_internalize.ll
new file mode 100644
index 00000000000..44e82c9fac7
--- /dev/null
+++ b/llvm/test/tools/gold/X86/Inputs/thinlto_internalize.ll
@@ -0,0 +1,6 @@
+target triple = "x86_64-unknown-linux-gnu"
+declare i32 @g()
+define i32 @main() {
+ call i32 @g()
+ ret i32 0
+}
diff --git a/llvm/test/tools/gold/X86/thinlto_alias.ll b/llvm/test/tools/gold/X86/thinlto_alias.ll
new file mode 100644
index 00000000000..f91c9bd2808
--- /dev/null
+++ b/llvm/test/tools/gold/X86/thinlto_alias.ll
@@ -0,0 +1,30 @@
+; RUN: opt -module-summary %s -o %t.o
+; RUN: opt -module-summary %p/Inputs/thinlto_alias.ll -o %t2.o
+
+; Ensure that a preempted weak symbol that is linked in as a local
+; copy is handled properly. Specifically, the local copy will be promoted,
+; and internalization should be able to use the original non-promoted
+; name to locate the summary (otherwise internalization will abort because
+; it expects to locate summaries for all definitions).
+; Note that gold picks the first copy of weakfunc() as the prevailing one,
+; so listing %t2.o first is sufficient to ensure that this copy is
+; preempted.
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=thinlto \
+; RUN: --plugin-opt=save-temps \
+; RUN: -o %t3.o %t2.o %t.o
+; RUN: llvm-nm %t3.o | FileCheck %s
+; RUN: llvm-dis %t.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
+; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
+
+; CHECK-NOT: U f
+; OPT: define hidden void @weakfunc.llvm.0()
+; OPT2: define weak void @weakfunc()
+
+target triple = "x86_64-unknown-linux-gnu"
+
+@weakfuncAlias = alias void (...), bitcast (void ()* @weakfunc to void (...)*)
+define weak void @weakfunc() {
+entry:
+ ret void
+}
diff --git a/llvm/test/tools/gold/X86/thinlto_internalize.ll b/llvm/test/tools/gold/X86/thinlto_internalize.ll
new file mode 100644
index 00000000000..5cf14250a3c
--- /dev/null
+++ b/llvm/test/tools/gold/X86/thinlto_internalize.ll
@@ -0,0 +1,21 @@
+; RUN: opt -module-summary %s -o %t.o
+; RUN: opt -module-summary %p/Inputs/thinlto_internalize.ll -o %t2.o
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=thinlto \
+; RUN: --plugin-opt=-import-instr-limit=0 \
+; RUN: --plugin-opt=save-temps \
+; RUN: -o %t3.o %t2.o %t.o
+; RUN: llvm-dis %t.o.opt.bc -o - | FileCheck %s
+
+; f() should be internalized and eliminated after inlining
+; CHECK-NOT: @f()
+
+target triple = "x86_64-unknown-linux-gnu"
+define i32 @g() {
+ call void @f()
+ ret i32 0
+}
+define void @f() {
+ ret void
+}
diff --git a/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll b/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll
index dd86c723e6f..1d2bb230860 100644
--- a/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll
+++ b/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll
@@ -11,6 +11,7 @@
; RUN: --plugin-opt=thinlto \
; RUN: --plugin-opt=-import-instr-limit=0 \
; RUN: --plugin-opt=save-temps \
+; RUN: -shared \
; RUN: -o %t3.o %t2.o %t.o
; RUN: llvm-nm %t3.o | FileCheck %s
; RUN: llvm-dis %t.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
OpenPOWER on IntegriCloud