summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-08-11 14:58:12 +0000
committerTeresa Johnson <tejohnson@google.com>2016-08-11 14:58:12 +0000
commit9ba95f99f3703fd06ce5912343526c2cc6ba353e (patch)
treebf52a79d2f8cf0359e7a9e7a932e37772b8d6fe8 /llvm/test
parent3818f1b38ae7b29dfeed0f11cff1a6b30fcc4f0e (diff)
downloadbcm5719-llvm-9ba95f99f3703fd06ce5912343526c2cc6ba353e.tar.gz
bcm5719-llvm-9ba95f99f3703fd06ce5912343526c2cc6ba353e.zip
Restore "Resolution-based LTO API."
This restores commit r278330, with fixes for a few bot failures: - Fix a late change I had made to the save temps output file that I missed due to existing files sitting on my disk - Fix a bunch of Windows bot failures with "ambiguous call to overloaded function" due to confusion between llvm::make_unique vs std::make_unique (preface the new make_unique calls with "llvm::") - Attempt to fix a modules bot failure by adding a missing include to LTO/Config.h. Original change: Resolution-based LTO API. Summary: This introduces a resolution-based LTO API. The main advantage of this API over existing APIs is that it allows the linker to supply a resolution for each symbol in each object, rather than the combined object as a whole. This will become increasingly important for use cases such as ThinLTO which require us to process symbol resolutions in a more complicated way than just adjusting linkage. Patch by Peter Collingbourne. Reviewers: rafael, tejohnson, mehdi_amini Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D20268 llvm-svn: 278338
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CMakeLists.txt1
-rw-r--r--llvm/test/LTO/Resolution/X86/Inputs/alias-1.ll4
-rw-r--r--llvm/test/LTO/Resolution/X86/Inputs/comdat.ll28
-rw-r--r--llvm/test/LTO/Resolution/X86/alias.ll22
-rw-r--r--llvm/test/LTO/Resolution/X86/comdat.ll86
-rw-r--r--llvm/test/LTO/Resolution/X86/lit.local.cfg2
-rw-r--r--llvm/test/lit.cfg1
-rw-r--r--llvm/test/tools/gold/X86/coff.ll2
-rw-r--r--llvm/test/tools/gold/X86/comdat.ll80
-rw-r--r--llvm/test/tools/gold/X86/common.ll10
-rw-r--r--llvm/test/tools/gold/X86/emit-llvm.ll51
-rw-r--r--llvm/test/tools/gold/X86/opt-level.ll6
-rw-r--r--llvm/test/tools/gold/X86/parallel.ll5
-rw-r--r--llvm/test/tools/gold/X86/slp-vectorize.ll2
-rw-r--r--llvm/test/tools/gold/X86/start-lib-common.ll2
-rw-r--r--llvm/test/tools/gold/X86/strip_names.ll2
-rw-r--r--llvm/test/tools/gold/X86/thinlto.ll10
-rw-r--r--llvm/test/tools/gold/X86/thinlto_alias.ll10
-rw-r--r--llvm/test/tools/gold/X86/thinlto_internalize.ll2
-rw-r--r--llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll6
-rw-r--r--llvm/test/tools/gold/X86/thinlto_weak_resolution.ll13
-rw-r--r--llvm/test/tools/gold/X86/type-merge2.ll2
-rw-r--r--llvm/test/tools/gold/X86/vectorize.ll2
-rw-r--r--llvm/test/tools/gold/X86/visibility.ll4
-rw-r--r--llvm/test/tools/llvm-lto2/errors.ll11
25 files changed, 267 insertions, 97 deletions
diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt
index e5773bda0e7..56fff69bad3 100644
--- a/llvm/test/CMakeLists.txt
+++ b/llvm/test/CMakeLists.txt
@@ -43,6 +43,7 @@ set(LLVM_TEST_DEPENDS
llvm-extract
llvm-lib
llvm-link
+ llvm-lto2
llvm-mc
llvm-mcmarkup
llvm-nm
diff --git a/llvm/test/LTO/Resolution/X86/Inputs/alias-1.ll b/llvm/test/LTO/Resolution/X86/Inputs/alias-1.ll
new file mode 100644
index 00000000000..01c9987fd3f
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/Inputs/alias-1.ll
@@ -0,0 +1,4 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@a = global i32 42
diff --git a/llvm/test/LTO/Resolution/X86/Inputs/comdat.ll b/llvm/test/LTO/Resolution/X86/Inputs/comdat.ll
new file mode 100644
index 00000000000..ca4bbb4bf81
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/Inputs/comdat.ll
@@ -0,0 +1,28 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+$c2 = comdat any
+$c1 = comdat any
+
+; This is only present in this file. The linker will keep $c1 from the first
+; file and this will be undefined.
+@will_be_undefined = global i32 1, comdat($c1)
+
+@v1 = weak_odr global i32 41, comdat($c2)
+define weak_odr protected i32 @f1(i8* %this) comdat($c2) {
+bb20:
+ store i8* %this, i8** null
+ br label %bb21
+bb21:
+ ret i32 41
+}
+
+@r21 = global i32* @v1
+@r22 = global i32(i8*)* @f1
+
+@a21 = alias i32, i32* @v1
+@a22 = alias i16, bitcast (i32* @v1 to i16*)
+
+@a23 = alias i32(i8*), i32(i8*)* @f1
+@a24 = alias i16, bitcast (i32(i8*)* @f1 to i16*)
+@a25 = alias i16, i16* @a24
diff --git a/llvm/test/LTO/Resolution/X86/alias.ll b/llvm/test/LTO/Resolution/X86/alias.ll
new file mode 100644
index 00000000000..bd3fcb381b3
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/alias.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as %s -o %t1.o
+; RUN: llvm-as %p/Inputs/alias-1.ll -o %t2.o
+; RUN: llvm-lto2 -o %t3.o %t2.o %t1.o -r %t2.o,a,px -r %t1.o,a, -r %t1.o,b,px -save-temps
+; RUN: llvm-dis < %t3.o.0.preopt.bc -o - | FileCheck %s
+; RUN: FileCheck --check-prefix=RES %s < %t3.o.resolution.txt
+
+; CHECK-NOT: alias
+; CHECK: @a = global i32 42
+; CHECK-NEXT: @b = global i32 1
+; CHECK-NOT: alias
+
+; RES: 2.o{{$}}
+; RES: {{^}}-r={{.*}}2.o,a,px{{$}}
+; RES: 1.o{{$}}
+; RES: {{^}}-r={{.*}}1.o,b,px{{$}}
+; RES: {{^}}-r={{.*}}1.o,a,{{$}}
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@a = weak alias i32, i32* @b
+@b = global i32 1
diff --git a/llvm/test/LTO/Resolution/X86/comdat.ll b/llvm/test/LTO/Resolution/X86/comdat.ll
new file mode 100644
index 00000000000..29bdcc325f3
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/comdat.ll
@@ -0,0 +1,86 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
+; RUN: llvm-lto2 -save-temps -o %t3.o %t.o %t2.o \
+; RUN: -r=%t.o,f1,plx \
+; RUN: -r=%t.o,v1,px \
+; RUN: -r=%t.o,r11,px \
+; RUN: -r=%t.o,r12,px \
+; RUN: -r=%t.o,a11,px \
+; RUN: -r=%t.o,a12,px \
+; RUN: -r=%t.o,a13,px \
+; RUN: -r=%t.o,a14,px \
+; RUN: -r=%t.o,a15,px \
+; RUN: -r=%t2.o,f1,l \
+; RUN: -r=%t2.o,will_be_undefined, \
+; RUN: -r=%t2.o,v1, \
+; RUN: -r=%t2.o,r21,px \
+; RUN: -r=%t2.o,r22,px \
+; RUN: -r=%t2.o,a21,px \
+; RUN: -r=%t2.o,a22,px \
+; RUN: -r=%t2.o,a23,px \
+; RUN: -r=%t2.o,a24,px \
+; RUN: -r=%t2.o,a25,px
+; RUN: llvm-dis %t3.o.2.internalize.bc -o - | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+$c1 = comdat any
+
+@v1 = weak_odr global i32 42, comdat($c1)
+define weak_odr i32 @f1(i8*) comdat($c1) {
+bb10:
+ br label %bb11
+bb11:
+ ret i32 42
+}
+
+@r11 = global i32* @v1
+@r12 = global i32 (i8*)* @f1
+
+@a11 = alias i32, i32* @v1
+@a12 = alias i16, bitcast (i32* @v1 to i16*)
+
+@a13 = alias i32 (i8*), i32 (i8*)* @f1
+@a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*)
+@a15 = alias i16, i16* @a14
+
+; CHECK: $c1 = comdat any
+; CHECK: $c2 = comdat any
+
+; CHECK-DAG: @v1 = weak_odr global i32 42, comdat($c1)
+
+; CHECK-DAG: @r11 = global i32* @v1{{$}}
+; CHECK-DAG: @r12 = global i32 (i8*)* @f1{{$}}
+
+; CHECK-DAG: @r21 = global i32* @v1{{$}}
+; CHECK-DAG: @r22 = global i32 (i8*)* @f1{{$}}
+
+; CHECK-DAG: @v1.1 = internal global i32 41, comdat($c2)
+
+; CHECK-DAG: @a11 = alias i32, i32* @v1{{$}}
+; CHECK-DAG: @a12 = alias i16, bitcast (i32* @v1 to i16*)
+
+; CHECK-DAG: @a13 = alias i32 (i8*), i32 (i8*)* @f1{{$}}
+; CHECK-DAG: @a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*)
+
+; CHECK-DAG: @a21 = alias i32, i32* @v1.1{{$}}
+; CHECK-DAG: @a22 = alias i16, bitcast (i32* @v1.1 to i16*)
+
+; CHECK-DAG: @a23 = alias i32 (i8*), i32 (i8*)* @f1.2{{$}}
+; CHECK-DAG: @a24 = alias i16, bitcast (i32 (i8*)* @f1.2 to i16*)
+
+; CHECK: define weak_odr i32 @f1(i8*) comdat($c1) {
+; CHECK-NEXT: bb10:
+; CHECK-NEXT: br label %bb11{{$}}
+; CHECK: bb11:
+; CHECK-NEXT: ret i32 42
+; CHECK-NEXT: }
+
+; CHECK: define internal i32 @f1.2(i8* %this) comdat($c2) {
+; CHECK-NEXT: bb20:
+; CHECK-NEXT: store i8* %this, i8** null
+; CHECK-NEXT: br label %bb21
+; CHECK: bb21:
+; CHECK-NEXT: ret i32 41
+; CHECK-NEXT: }
diff --git a/llvm/test/LTO/Resolution/X86/lit.local.cfg b/llvm/test/LTO/Resolution/X86/lit.local.cfg
new file mode 100644
index 00000000000..afde89be896
--- /dev/null
+++ b/llvm/test/LTO/Resolution/X86/lit.local.cfg
@@ -0,0 +1,2 @@
+if not 'X86' in config.root.targets:
+ config.unsupported = True
diff --git a/llvm/test/lit.cfg b/llvm/test/lit.cfg
index f9f82d16833..12676372b07 100644
--- a/llvm/test/lit.cfg
+++ b/llvm/test/lit.cfg
@@ -295,6 +295,7 @@ for pattern in [r"\bbugpoint\b(?!-)",
r"\bllvm-lib\b",
r"\bllvm-link\b",
r"\bllvm-lto\b",
+ r"\bllvm-lto2\b",
r"\bllvm-mc\b",
r"\bllvm-mcmarkup\b",
r"\bllvm-nm\b",
diff --git a/llvm/test/tools/gold/X86/coff.ll b/llvm/test/tools/gold/X86/coff.ll
index 7ab80707ba1..70d4f916159 100644
--- a/llvm/test/tools/gold/X86/coff.ll
+++ b/llvm/test/tools/gold/X86/coff.ll
@@ -16,7 +16,7 @@ define hidden void @g() {
ret void
}
-; CHECK: define internal void @h() local_unnamed_addr {
+; CHECK: define internal void @h() {
define linkonce_odr void @h() local_unnamed_addr {
ret void
}
diff --git a/llvm/test/tools/gold/X86/comdat.ll b/llvm/test/tools/gold/X86/comdat.ll
index b5a09d8329c..2170bf89d0c 100644
--- a/llvm/test/tools/gold/X86/comdat.ll
+++ b/llvm/test/tools/gold/X86/comdat.ll
@@ -1,8 +1,9 @@
-; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %s -o %t1.o
; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
-; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t.o %t2.o \
+; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t1.o %t2.o \
; RUN: -plugin-opt=save-temps
-; RUN: llvm-dis %t3.o.bc -o - | FileCheck %s
+; RUN: FileCheck --check-prefix=RES %s < %t3.o.resolution.txt
+; RUN: llvm-readobj -t %t3.o | FileCheck --check-prefix=OBJ %s
$c1 = comdat any
@@ -24,42 +25,37 @@ bb11:
@a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*)
@a15 = alias i16, i16* @a14
-; CHECK: $c1 = comdat any
-; CHECK: $c2 = comdat any
-
-; CHECK-DAG: @v1 = weak_odr global i32 42, comdat($c1)
-
-; CHECK-DAG: @r11 = global i32* @v1{{$}}
-; CHECK-DAG: @r12 = global i32 (i8*)* @f1{{$}}
-
-; CHECK-DAG: @r21 = global i32* @v1{{$}}
-; CHECK-DAG: @r22 = global i32 (i8*)* @f1{{$}}
-
-; CHECK-DAG: @v1.1 = internal global i32 41, comdat($c2)
-
-; CHECK-DAG: @a11 = alias i32, i32* @v1{{$}}
-; CHECK-DAG: @a12 = alias i16, bitcast (i32* @v1 to i16*)
-
-; CHECK-DAG: @a13 = alias i32 (i8*), i32 (i8*)* @f1{{$}}
-; CHECK-DAG: @a14 = alias i16, bitcast (i32 (i8*)* @f1 to i16*)
-
-; CHECK-DAG: @a21 = alias i32, i32* @v1.1{{$}}
-; CHECK-DAG: @a22 = alias i16, bitcast (i32* @v1.1 to i16*)
-
-; CHECK-DAG: @a23 = alias i32 (i8*), i32 (i8*)* @f1.2{{$}}
-; CHECK-DAG: @a24 = alias i16, bitcast (i32 (i8*)* @f1.2 to i16*)
-
-; CHECK: define weak_odr protected i32 @f1(i8*) comdat($c1) {
-; CHECK-NEXT: bb10:
-; CHECK-NEXT: br label %bb11{{$}}
-; CHECK: bb11:
-; CHECK-NEXT: ret i32 42
-; CHECK-NEXT: }
-
-; CHECK: define internal i32 @f1.2(i8* %this) comdat($c2) {
-; CHECK-NEXT: bb20:
-; CHECK-NEXT: store i8* %this, i8** null
-; CHECK-NEXT: br label %bb21
-; CHECK: bb21:
-; CHECK-NEXT: ret i32 41
-; CHECK-NEXT: }
+; gold's resolutions should tell us that our $c1 wins, and the other input's $c2
+; wins. f1 is also local due to having protected visibility in the other object.
+
+; RES: 1.o,f1,plx{{$}}
+; RES: 1.o,v1,px{{$}}
+; RES: 1.o,r11,px{{$}}
+; RES: 1.o,r12,px{{$}}
+; RES: 1.o,a11,px{{$}}
+; RES: 1.o,a12,px{{$}}
+; RES: 1.o,a13,px{{$}}
+; RES: 1.o,a14,px{{$}}
+; RES: 1.o,a15,px{{$}}
+
+; RES: 2.o,f1,l{{$}}
+; RES: 2.o,will_be_undefined,{{$}}
+; RES: 2.o,v1,{{$}}
+; RES: 2.o,r21,px{{$}}
+; RES: 2.o,r22,px{{$}}
+; RES: 2.o,a21,px{{$}}
+; RES: 2.o,a22,px{{$}}
+; RES: 2.o,a23,px{{$}}
+; RES: 2.o,a24,px{{$}}
+; RES: 2.o,a25,px{{$}}
+
+; f1's protected visibility should be reflected in the DSO.
+
+; OBJ: Name: f1 (
+; OBJ-NEXT: Value:
+; OBJ-NEXT: Size:
+; OBJ-NEXT: Binding:
+; OBJ-NEXT: Type:
+; OBJ-NEXT: Other [
+; OBJ-NEXT: STV_PROTECTED
+; OBJ-NEXT: ]
diff --git a/llvm/test/tools/gold/X86/common.ll b/llvm/test/tools/gold/X86/common.ll
index 335f6e9a88a..d0c5f1873e0 100644
--- a/llvm/test/tools/gold/X86/common.ll
+++ b/llvm/test/tools/gold/X86/common.ll
@@ -11,7 +11,7 @@
; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=A
; Shared library case, we merge @a as common and keep it for the symbol table.
-; A: @a = common global i32 0, align 8
+; A: @a = common global [4 x i8] zeroinitializer, align 8
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=emit-llvm \
@@ -19,7 +19,7 @@
; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=B
; (i16 align 8) + (i8 align 16) = i16 align 16
-; B: @a = common global i16 0, align 16
+; B: @a = common global [2 x i8] zeroinitializer, align 16
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=emit-llvm \
@@ -27,7 +27,7 @@
; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=C
; (i16 align 8) + (i8 align 1) = i16 align 8.
-; C: @a = common global i16 0, align 8
+; C: @a = common global [2 x i8] zeroinitializer, align 8
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=emit-llvm \
@@ -35,7 +35,7 @@
; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s
; All IR case, we internalize a after merging.
-; EXEC: @a = internal global i32 0, align 8
+; EXEC: @a = internal global [4 x i8] zeroinitializer, align 8
; RUN: llc %p/Inputs/common.ll -o %t2native.o -filetype=obj
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
@@ -44,4 +44,4 @@
; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s
; Mixed ELF and IR. We keep ours as common so the linker will finish the merge.
-; MIXED: @a = common global i16 0, align 8
+; MIXED: @a = common global [2 x i8] zeroinitializer, align 8
diff --git a/llvm/test/tools/gold/X86/emit-llvm.ll b/llvm/test/tools/gold/X86/emit-llvm.ll
index 0a955088c40..da59c707ea6 100644
--- a/llvm/test/tools/gold/X86/emit-llvm.ll
+++ b/llvm/test/tools/gold/X86/emit-llvm.ll
@@ -2,17 +2,16 @@
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=emit-llvm \
-; RUN: --plugin-opt=generate-api-file \
; RUN: -shared %t.o -o %t2.o
; RUN: llvm-dis %t2.o -o - | FileCheck %s
-; RUN: FileCheck --check-prefix=API %s < %T/../apifile.txt
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: -m elf_x86_64 --plugin-opt=save-temps \
; RUN: -shared %t.o -o %t3.o
-; RUN: llvm-dis %t3.o.bc -o - | FileCheck %s
-; RUN: llvm-dis %t3.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
-; RUN: llvm-dis %t3.o.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
+; RUN: FileCheck --check-prefix=RES %s < %t3.o.resolution.txt
+; RUN: llvm-dis %t3.o.2.internalize.bc -o - | FileCheck %s
+; RUN: llvm-dis %t3.o.4.opt.bc -o - | FileCheck --check-prefix=OPT %s
+; RUN: llvm-dis %t3.o.4.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
; RUN: llvm-nm %t3.o.o | FileCheck --check-prefix=NM %s
; RUN: rm -f %t4.o
@@ -25,19 +24,19 @@
target triple = "x86_64-unknown-linux-gnu"
-; CHECK-DAG: @g1 = linkonce_odr constant i32 32
+; CHECK-DAG: @g1 = weak_odr constant i32 32
@g1 = linkonce_odr constant i32 32
-; CHECK-DAG: @g2 = internal local_unnamed_addr constant i32 32
+; CHECK-DAG: @g2 = internal constant i32 32
@g2 = linkonce_odr local_unnamed_addr constant i32 32
; CHECK-DAG: @g3 = internal unnamed_addr constant i32 32
@g3 = linkonce_odr unnamed_addr constant i32 32
-; CHECK-DAG: @g4 = linkonce_odr global i32 32
+; CHECK-DAG: @g4 = weak_odr global i32 32
@g4 = linkonce_odr global i32 32
-; CHECK-DAG: @g5 = linkonce_odr local_unnamed_addr global i32 32
+; CHECK-DAG: @g5 = weak_odr global i32 32
@g5 = linkonce_odr local_unnamed_addr global i32 32
; CHECK-DAG: @g6 = internal unnamed_addr global i32 32
@@ -75,8 +74,8 @@ define linkonce_odr void @f4() local_unnamed_addr {
ret void
}
-; CHECK-DAG: define linkonce_odr void @f5()
-; OPT-DAG: define linkonce_odr void @f5()
+; CHECK-DAG: define weak_odr void @f5()
+; OPT-DAG: define weak_odr void @f5()
define linkonce_odr void @f5() {
ret void
}
@@ -97,15 +96,21 @@ define i32* @f8() {
ret i32* @g8
}
-; API: f1 PREVAILING_DEF_IRONLY
-; API: f2 PREVAILING_DEF_IRONLY
-; API: f3 PREVAILING_DEF_IRONLY_EXP
-; API: f4 PREVAILING_DEF_IRONLY_EXP
-; API: f5 PREVAILING_DEF_IRONLY_EXP
-; API: f6 PREVAILING_DEF_IRONLY_EXP
-; API: f7 PREVAILING_DEF_IRONLY_EXP
-; API: f8 PREVAILING_DEF_IRONLY_EXP
-; API: g7 UNDEF
-; API: g8 UNDEF
-; API: g9 PREVAILING_DEF_IRONLY_EXP
-; API: g10 PREVAILING_DEF_IRONLY_EXP
+; RES: .o,f1,pl{{$}}
+; RES: .o,f2,pl{{$}}
+; RES: .o,f3,px{{$}}
+; RES: .o,f4,p{{$}}
+; RES: .o,f5,px{{$}}
+; RES: .o,f6,p{{$}}
+; RES: .o,f7,px{{$}}
+; RES: .o,f8,px{{$}}
+; RES: .o,g1,px{{$}}
+; RES: .o,g2,p{{$}}
+; RES: .o,g3,p{{$}}
+; RES: .o,g4,px{{$}}
+; RES: .o,g5,px{{$}}
+; RES: .o,g6,p{{$}}
+; RES: .o,g7,{{$}}
+; RES: .o,g8,{{$}}
+; RES: .o,g9,px{{$}}
+; RES: .o,g10,px{{$}}
diff --git a/llvm/test/tools/gold/X86/opt-level.ll b/llvm/test/tools/gold/X86/opt-level.ll
index a3cd844a142..a680a169836 100644
--- a/llvm/test/tools/gold/X86/opt-level.ll
+++ b/llvm/test/tools/gold/X86/opt-level.ll
@@ -1,13 +1,13 @@
; RUN: llvm-as -o %t.bc %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
; RUN: -plugin-opt=O0 -r -o %t.o %t.bc
-; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O0 %s
+; RUN: llvm-dis < %t.o.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O0 %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
; RUN: -plugin-opt=O1 -r -o %t.o %t.bc
-; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 %s
+; RUN: llvm-dis < %t.o.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
; RUN: -plugin-opt=O2 -r -o %t.o %t.bc
-; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O2 %s
+; RUN: llvm-dis < %t.o.4.opt.bc -o - | FileCheck --check-prefix=CHECK-O2 %s
; CHECK-O0: define internal void @foo(
; CHECK-O1: define internal void @foo(
diff --git a/llvm/test/tools/gold/X86/parallel.ll b/llvm/test/tools/gold/X86/parallel.ll
index 57d13768cd4..4b078fa2111 100644
--- a/llvm/test/tools/gold/X86/parallel.ll
+++ b/llvm/test/tools/gold/X86/parallel.ll
@@ -1,7 +1,8 @@
; RUN: llvm-as -o %t.bc %s
+; RUN: rm -f %t.opt.bc0 %t.opt.bc1 %t.o0 %t.o1
; RUN: env LD_PRELOAD=%llvmshlibdir/LLVMgold.so %gold -plugin %llvmshlibdir/LLVMgold.so -u foo -u bar -plugin-opt jobs=2 -plugin-opt save-temps -m elf_x86_64 -o %t %t.bc
-; RUN: llvm-dis %t.opt.bc0 -o - | FileCheck --check-prefix=CHECK-BC0 %s
-; RUN: llvm-dis %t.opt.bc1 -o - | FileCheck --check-prefix=CHECK-BC1 %s
+; RUN: llvm-dis %t.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC0 %s
+; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC1 %s
; RUN: llvm-nm %t.o0 | FileCheck --check-prefix=CHECK0 %s
; RUN: llvm-nm %t.o1 | FileCheck --check-prefix=CHECK1 %s
diff --git a/llvm/test/tools/gold/X86/slp-vectorize.ll b/llvm/test/tools/gold/X86/slp-vectorize.ll
index 30950b2d2de..3464359afbf 100644
--- a/llvm/test/tools/gold/X86/slp-vectorize.ll
+++ b/llvm/test/tools/gold/X86/slp-vectorize.ll
@@ -3,7 +3,7 @@
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=save-temps \
; RUN: -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
+; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck %s
; test that the vectorizer is run.
; CHECK: fadd <4 x float>
diff --git a/llvm/test/tools/gold/X86/start-lib-common.ll b/llvm/test/tools/gold/X86/start-lib-common.ll
index 89bdbef2234..7c8945585a5 100644
--- a/llvm/test/tools/gold/X86/start-lib-common.ll
+++ b/llvm/test/tools/gold/X86/start-lib-common.ll
@@ -19,4 +19,4 @@
; Check that the common symbol is not dropped completely, which was a regression
; in r262676.
-; CHECK: @x = common global i32 0
+; CHECK: @x = common global [4 x i8] zeroinitializer
diff --git a/llvm/test/tools/gold/X86/strip_names.ll b/llvm/test/tools/gold/X86/strip_names.ll
index 495eac9d541..c196f25703d 100644
--- a/llvm/test/tools/gold/X86/strip_names.ll
+++ b/llvm/test/tools/gold/X86/strip_names.ll
@@ -3,7 +3,7 @@
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=save-temps \
; RUN: -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o.bc -o - | FileCheck %s
+; RUN: llvm-dis %t2.o.2.internalize.bc -o - | FileCheck %s
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=emit-llvm \
diff --git a/llvm/test/tools/gold/X86/thinlto.ll b/llvm/test/tools/gold/X86/thinlto.ll
index 09bf21d4a82..9b0d96db47c 100644
--- a/llvm/test/tools/gold/X86/thinlto.ll
+++ b/llvm/test/tools/gold/X86/thinlto.ll
@@ -25,21 +25,23 @@
; RUN: llvm-bcanalyzer -dump %t2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND2
; RUN: not test -e %t3
-; Ensure gold generates an index as well as a binary by default in ThinLTO mode.
+; Ensure gold generates an index as well as a binary with save-temps in ThinLTO mode.
; First force single-threaded mode
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=save-temps \
; RUN: --plugin-opt=thinlto \
; RUN: --plugin-opt=jobs=1 \
; RUN: -shared %t.o %t2.o -o %t4
-; RUN: llvm-bcanalyzer -dump %t4.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED
; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
; Next force multi-threaded mode
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=save-temps \
; RUN: --plugin-opt=thinlto \
; RUN: --plugin-opt=jobs=2 \
; RUN: -shared %t.o %t2.o -o %t4
-; RUN: llvm-bcanalyzer -dump %t4.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED
; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
; Test --plugin-opt=obj-path to ensure unique object files generated.
@@ -48,8 +50,8 @@
; RUN: --plugin-opt=jobs=2 \
; RUN: --plugin-opt=obj-path=%t5.o \
; RUN: -shared %t.o %t2.o -o %t4
-; RUN: llvm-nm %t5.o0 | FileCheck %s --check-prefix=NM2
; RUN: llvm-nm %t5.o1 | FileCheck %s --check-prefix=NM2
+; RUN: llvm-nm %t5.o2 | FileCheck %s --check-prefix=NM2
; NM: T f
; NM2: T {{f|g}}
diff --git a/llvm/test/tools/gold/X86/thinlto_alias.ll b/llvm/test/tools/gold/X86/thinlto_alias.ll
index f91c9bd2808..33c888daf17 100644
--- a/llvm/test/tools/gold/X86/thinlto_alias.ll
+++ b/llvm/test/tools/gold/X86/thinlto_alias.ll
@@ -14,8 +14,14 @@
; 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
+; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck --check-prefix=OPT %s
+; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
+
+; This does not currently pass because the gold plugin now uses the
+; combined summary rather than the IRMover to change the module's linkage
+; during the ThinLTO backend. The internalization step implemented by IRMover
+; for preempted symbols has not yet been implemented for the combined summary.
+; XFAIL: *
; CHECK-NOT: U f
; OPT: define hidden void @weakfunc.llvm.0()
diff --git a/llvm/test/tools/gold/X86/thinlto_internalize.ll b/llvm/test/tools/gold/X86/thinlto_internalize.ll
index 4d626ee0d60..8d0033c1f98 100644
--- a/llvm/test/tools/gold/X86/thinlto_internalize.ll
+++ b/llvm/test/tools/gold/X86/thinlto_internalize.ll
@@ -6,7 +6,7 @@
; 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
+; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck %s
; f() should be internalized and eliminated after inlining
; CHECK-NOT: @f()
diff --git a/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll b/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll
index 1d2bb230860..810b2dd7b2d 100644
--- a/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll
+++ b/llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll
@@ -14,13 +14,13 @@
; 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
-; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
+; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck --check-prefix=OPT %s
+; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
; Ensure that f() is defined in resulting object file, and also
; confirm the weak linkage directly in the saved opt bitcode files.
; CHECK-NOT: U f
-; OPT: declare hidden void @f()
+; OPT-NOT: @f()
; OPT2: define weak_odr hidden void @f()
target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/tools/gold/X86/thinlto_weak_resolution.ll b/llvm/test/tools/gold/X86/thinlto_weak_resolution.ll
index a6c6f37895b..afa6fd07bae 100644
--- a/llvm/test/tools/gold/X86/thinlto_weak_resolution.ll
+++ b/llvm/test/tools/gold/X86/thinlto_weak_resolution.ll
@@ -13,12 +13,17 @@
; RUN: llvm-nm %t3.o | FileCheck %s
; CHECK: weakfunc
-; All of the preempted functions should have been eliminated (the plugin will
-; not link them in).
-; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
+; Most of the preempted functions should have been eliminated (the plugin will
+; set linkage of odr functions to available_externally and linkonce functions
+; are removed by globaldce). FIXME: Need to introduce combined index linkage
+; that means "drop this function" so we can avoid importing linkonce functions
+; and drop weak functions.
+; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck --check-prefix=OPT2 %s
+; OPT2-NOT: @
+; OPT2: @weakfunc
; OPT2-NOT: @
-; RUN: llvm-dis %t.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
+; RUN: llvm-dis %t.o.4.opt.bc -o - | FileCheck --check-prefix=OPT %s
target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/tools/gold/X86/type-merge2.ll b/llvm/test/tools/gold/X86/type-merge2.ll
index 449fd216503..c66ba22cf08 100644
--- a/llvm/test/tools/gold/X86/type-merge2.ll
+++ b/llvm/test/tools/gold/X86/type-merge2.ll
@@ -3,7 +3,7 @@
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=save-temps \
; RUN: -shared %t.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o.bc -o - | FileCheck %s
+; RUN: llvm-dis %t3.o.2.internalize.bc -o - | FileCheck %s
%zed = type { i8 }
define void @foo() {
diff --git a/llvm/test/tools/gold/X86/vectorize.ll b/llvm/test/tools/gold/X86/vectorize.ll
index 5f003dd02e2..9b5c97259b2 100644
--- a/llvm/test/tools/gold/X86/vectorize.ll
+++ b/llvm/test/tools/gold/X86/vectorize.ll
@@ -3,7 +3,7 @@
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=save-temps \
; RUN: -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
+; RUN: llvm-dis %t2.o.4.opt.bc -o - | FileCheck %s
; test that the vectorizer is run.
; CHECK: fadd <4 x float>
diff --git a/llvm/test/tools/gold/X86/visibility.ll b/llvm/test/tools/gold/X86/visibility.ll
index 9af8788889d..f7e085a45fc 100644
--- a/llvm/test/tools/gold/X86/visibility.ll
+++ b/llvm/test/tools/gold/X86/visibility.ll
@@ -5,7 +5,7 @@
; RUN: --plugin-opt=save-temps \
; RUN: -shared %t.o %t2.o -o %t.so
; RUN: llvm-readobj -t %t.so | FileCheck %s
-; RUN: llvm-dis %t.so.bc -o - | FileCheck --check-prefix=IR %s
+; RUN: llvm-dis %t.so.2.internalize.bc -o - | FileCheck --check-prefix=IR %s
; CHECK: Name: foo
; CHECK-NEXT: Value:
@@ -16,7 +16,7 @@
; CHECK-NEXT: STV_PROTECTED
; CHECK-NEXT: ]
-; IR: define protected void @foo
+; IR: define void @foo
define weak protected void @foo() {
ret void
diff --git a/llvm/test/tools/llvm-lto2/errors.ll b/llvm/test/tools/llvm-lto2/errors.ll
new file mode 100644
index 00000000000..cd2394dc012
--- /dev/null
+++ b/llvm/test/tools/llvm-lto2/errors.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as %s -o %t.bc
+; RUN: not llvm-lto2 -o %t2.o %t.bc 2>&1 | FileCheck --check-prefix=ERR1 %s
+; RUN: not llvm-lto2 -o %t2.o -r %t.bc,foo,p -r %t.bc,bar,p %t.bc 2>&1 | FileCheck --check-prefix=ERR2 %s
+; RUN: not llvm-lto2 -o %t2.o -r %t.bc,foo,q %t.bc 2>&1 | FileCheck --check-prefix=ERR3 %s
+; RUN: not llvm-lto2 -o %t2.o -r foo %t.bc 2>&1 | FileCheck --check-prefix=ERR4 %s
+
+; ERR1: missing symbol resolution for {{.*}}.bc,foo
+; ERR2: unused symbol resolution for {{.*}}.bc,bar
+; ERR3: invalid character q in resolution: {{.*}}.bc,foo
+; ERR4: invalid resolution: foo
+@foo = global i32 0
OpenPOWER on IntegriCloud