summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2018-01-29 08:03:30 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2018-01-29 08:03:30 +0000
commiteaf5172ca6be291677f6f84cffae0c66656600a3 (patch)
treea4a2196f3b147192435ca6632a267cc7cd06c4d8 /llvm/test
parent62b62356fae9a66a7bdbf33d5790d7db39c9af5e (diff)
downloadbcm5719-llvm-eaf5172ca6be291677f6f84cffae0c66656600a3.tar.gz
bcm5719-llvm-eaf5172ca6be291677f6f84cffae0c66656600a3.zip
[ThinLTO] - Stop internalizing and drop non-prevailing symbols.
Implementation marks non-prevailing symbols as not live in the summary. Then them are dropped in backends. Fixes https://bugs.llvm.org/show_bug.cgi?id=35938 Differential revision: https://reviews.llvm.org/D42107 llvm-svn: 323633
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/LTO/Resolution/X86/Inputs/not-prevailing.ll6
-rw-r--r--llvm/test/LTO/Resolution/X86/not-prevailing.ll37
-rw-r--r--llvm/test/ThinLTO/X86/deadstrip.ll2
-rw-r--r--llvm/test/ThinLTO/X86/internalize.ll1
-rw-r--r--llvm/test/tools/gold/X86/global_with_section.ll9
5 files changed, 51 insertions, 4 deletions
diff --git a/llvm/test/LTO/Resolution/X86/Inputs/not-prevailing.ll b/llvm/test/LTO/Resolution/X86/Inputs/not-prevailing.ll
new file mode 100644
index 00000000000..68b3c836280
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/Inputs/not-prevailing.ll
@@ -0,0 +1,6 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @bar() {
+ ret void
+}
diff --git a/llvm/test/LTO/Resolution/X86/not-prevailing.ll b/llvm/test/LTO/Resolution/X86/not-prevailing.ll
new file mode 100644
index 00000000000..36d86ca9104
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/not-prevailing.ll
@@ -0,0 +1,37 @@
+; RUN: opt -module-summary %s -o %t1.o
+; RUN: opt -module-summary -o %t2.o %S/Inputs/not-prevailing.ll
+; RUN: llvm-lto2 run -o %t3.o %t1.o %t2.o -r %t1.o,foo,x -r %t1.o,zed,px -r %t1.o,bar,x \
+; RUN: -r %t2.o,bar,x -save-temps
+
+; Check that 'foo' and 'bar' were not inlined.
+; CHECK: zed:
+; CHECK-NEXT: {{.*}} pushq %rbx
+; CHECK-NEXT: {{.*}} callq 0 <zed+0x6>
+; CHECK-NEXT: {{.*}} movl %eax, %ebx
+; CHECK-NEXT: {{.*}} callq 0 <zed+0xd>
+; CHECK-NEXT: {{.*}} movl %ebx, %eax
+; CHECK-NEXT: {{.*}} popq %rbx
+; CHECK-NEXT: {{.*}} retq
+
+; RUN: llvm-objdump -d %t3.o.1 | FileCheck %s
+; RUN: llvm-readelf --symbols %t3.o.1 | FileCheck %s --check-prefix=SYMBOLS
+
+; Check that 'foo' and 'bar' produced as undefined.
+; SYMBOLS: NOTYPE GLOBAL DEFAULT UND bar
+; SYMBOLS: NOTYPE GLOBAL DEFAULT UND foo
+; SYMBOLS: FUNC GLOBAL DEFAULT 2 zed
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define weak i32 @foo() {
+ ret i32 65
+}
+
+declare void @bar()
+
+define i32 @zed() {
+ %1 = tail call i32 @foo()
+ call void @bar()
+ ret i32 %1
+}
diff --git a/llvm/test/ThinLTO/X86/deadstrip.ll b/llvm/test/ThinLTO/X86/deadstrip.ll
index 0764f5c073c..f1a587359c8 100644
--- a/llvm/test/ThinLTO/X86/deadstrip.ll
+++ b/llvm/test/ThinLTO/X86/deadstrip.ll
@@ -50,7 +50,7 @@
; LTO2: define internal void @_GLOBAL__I_a()
; LTO2: define internal void @bar() {
; LTO2: define internal void @bar_internal()
-; LTO2: define internal void @dead_func() {
+; LTO2: declare dso_local void @dead_func()
; LTO2-NOT: available_externally {{.*}} @baz()
; Make sure we didn't internalize @boo, which is reachable via
diff --git a/llvm/test/ThinLTO/X86/internalize.ll b/llvm/test/ThinLTO/X86/internalize.ll
index 9ff173e8cca..433cfe40894 100644
--- a/llvm/test/ThinLTO/X86/internalize.ll
+++ b/llvm/test/ThinLTO/X86/internalize.ll
@@ -24,6 +24,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
define void @foo() {
+ call void @bar()
ret void
}
define void @bar() {
diff --git a/llvm/test/tools/gold/X86/global_with_section.ll b/llvm/test/tools/gold/X86/global_with_section.ll
index d2b7097d812..4728ae34439 100644
--- a/llvm/test/tools/gold/X86/global_with_section.ll
+++ b/llvm/test/tools/gold/X86/global_with_section.ll
@@ -22,7 +22,7 @@
; RUN: --plugin-opt=save-temps \
; RUN: -o %t3.o %t.o %t2.o
; Check results of internalization
-; RUN: llvm-dis %t.o.2.internalize.bc -o - | FileCheck %s
+; RUN: llvm-dis %t.o.2.internalize.bc -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-THINLTO
; RUN: llvm-dis %t2.o.2.internalize.bc -o - | FileCheck %s --check-prefix=CHECK2-THINLTO
; SYMTAB: deadfunc_with_section
@@ -57,7 +57,9 @@ define void @deadfunc_with_section() section "some_other_section" {
; Confirm via a function with a non-C identifier section that we are getting
; the expected internalization.
-; CHECK-DAG: define internal void @deadfunc_with_nonC_section() section ".nonCsection"
+; CHECK2-REGULARLTO-DAG: define internal void @deadfunc_with_nonC_section() section ".nonCsection"
+; Check dead function converted to declaration.
+; CHECK-THINLTO-DAG: declare dso_local void @deadfunc_with_nonC_section() section ".nonCsection"
define void @deadfunc_with_nonC_section() section ".nonCsection" {
call void @deadfunc2_called_from_nonC_section()
ret void
@@ -75,5 +77,6 @@ declare void @deadfunc2_called_from_section()
; Confirm when called from a function with a non-C identifier section that we
; are getting the expected internalization.
; CHECK2-REGULARLTO: define internal void @deadfunc2_called_from_nonC_section
-; CHECK2-THINLTO: define internal void @deadfunc2_called_from_nonC_section
+; Check dead function converted to declaration.
+; CHECK2-THINLTO: declare dso_local void @deadfunc2_called_from_nonC_section
declare void @deadfunc2_called_from_nonC_section()
OpenPOWER on IntegriCloud