+++ /dev/null
-@a = global i32 42
+++ /dev/null
-.section .llvmbc
-.incbin "bcsection.bc"
+++ /dev/null
-$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* @v1
-@a22 = alias bitcast (i32* @v1 to i16*)
-
-@a23 = alias i32(i8*)* @f1
-@a24 = alias bitcast (i32(i8*)* @f1 to i16*)
-@a25 = alias i16* @a24
+++ /dev/null
-@a = common global i16 0, align 4
+++ /dev/null
-{
- global:
- f;
- local: *;
-};
+++ /dev/null
-define weak_odr void @f() {
- ret void
-}
+++ /dev/null
-target triple = "x86_64-unknown-linux-gnu"
-define linkonce_odr hidden void @f() {
- ret void
-}
+++ /dev/null
-@a = weak global i32 41
-@c = global i32* @a
--- /dev/null
+if (not 'ld_plugin' in config.available_features or
+ not 'PowerPC' in config.root.targets):
+ config.unsupported = True
--- /dev/null
+; REQUIRES: ld_emu_elf32ppc
+
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -m elf32ppc \
+; RUN: -plugin-opt=mtriple=powerpc-linux-gnu \
+; RUN: -plugin-opt=obj-path=%t3.o \
+; RUN: -shared %t.o -o %t2
+; RUN: llvm-readobj --file-headers %t2 | FileCheck --check-prefix=DSO %s
+; RUN: llvm-readobj --file-headers %t3.o | FileCheck --check-prefix=REL %s
+
+; REL: Type: Relocatable
+; REL-NEXT: Machine: EM_PPC
+
+; DSO: Type: SharedObject
+; DSO-NEXT: Machine: EM_PPC
--- /dev/null
+@a = global i32 42
--- /dev/null
+.section .llvmbc
+.incbin "bcsection.bc"
--- /dev/null
+$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* @v1
+@a22 = alias bitcast (i32* @v1 to i16*)
+
+@a23 = alias i32(i8*)* @f1
+@a24 = alias bitcast (i32(i8*)* @f1 to i16*)
+@a25 = alias i16* @a24
--- /dev/null
+@a = common global i16 0, align 4
--- /dev/null
+{
+ global:
+ f;
+ local: *;
+};
--- /dev/null
+define weak_odr void @f() {
+ ret void
+}
--- /dev/null
+target triple = "x86_64-unknown-linux-gnu"
+define linkonce_odr hidden void @f() {
+ ret void
+}
--- /dev/null
+@a = weak global i32 41
+@c = global i32* @a
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/alias-1.ll -o %t2.o
+; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o \
+; RUN: -plugin-opt=emit-llvm
+; RUN: llvm-dis < %t3.o -o - | FileCheck %s
+
+; CHECK-NOT: alias
+; CHECK: @a = global i32 42
+; CHECK-NEXT: @b = global i32 1
+; CHECK-NOT: alias
+
+@a = weak alias i32* @b
+@b = global i32 1
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+
+; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o -o %t2.o 2>&1 | FileCheck %s
+
+; CHECK: Unable to determine comdat of alias!
+
+@g1 = global i32 1
+@g2 = global i32 2
+
+@a = alias inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
+ i32 ptrtoint (i32* @g2 to i32)) to i32*)
--- /dev/null
+; RUN: llvm-as -o %T/bcsection.bc %s
+
+; RUN: llvm-mc -I=%T -filetype=obj -o %T/bcsection.bco %p/Inputs/bcsection.s
+; RUN: llvm-nm -no-llvm-bc %T/bcsection.bco | count 0
+; RUN: %gold -r -o %T/bcsection.o -plugin %llvmshlibdir/LLVMgold.so %T/bcsection.bco
+; RUN: llvm-nm -no-llvm-bc %T/bcsection.o | FileCheck %s
+
+; CHECK: main
+define i32 @main() {
+ ret i32 0
+}
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
+; RUN: -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+
+target datalayout = "m:w"
+
+; CHECK: define void @f() {
+define void @f() {
+ ret void
+}
+
+; CHECK: define internal void @g() {
+define hidden void @g() {
+ ret void
+}
+
+; CHECK: define internal void @h() {
+define linkonce_odr void @h() {
+ ret void
+}
--- /dev/null
+; RUN: llvm-as %s -o %t.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: -plugin-opt=emit-llvm
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+$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* @v1
+@a12 = alias bitcast (i32* @v1 to i16*)
+
+@a13 = alias i32 (i8*)* @f1
+@a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
+@a15 = alias i16* @a14
+
+; CHECK: $c1 = comdat any
+; CHECK: $c2 = comdat any
+
+; CHECK: @v1 = weak_odr global i32 42, comdat($c1)
+
+; CHECK: @r11 = global i32* @v1{{$}}
+; CHECK: @r12 = global i32 (i8*)* @f1{{$}}
+
+; CHECK: @r21 = global i32* @v1{{$}}
+; CHECK: @r22 = global i32 (i8*)* @f1{{$}}
+
+; CHECK: @v11 = internal global i32 41, comdat($c2)
+
+; CHECK: @a11 = alias i32* @v1{{$}}
+; CHECK: @a12 = alias bitcast (i32* @v1 to i16*)
+
+; CHECK: @a13 = alias i32 (i8*)* @f1{{$}}
+; CHECK: @a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
+
+; CHECK: @a21 = alias i32* @v11{{$}}
+; CHECK: @a22 = alias bitcast (i32* @v11 to i16*)
+
+; CHECK: @a23 = alias i32 (i8*)* @f12{{$}}
+; CHECK: @a24 = alias bitcast (i32 (i8*)* @f12 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 @f12(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: }
--- /dev/null
+; RUN: llvm-as %s -o %t1.o
+; RUN: llvm-as %p/Inputs/common.ll -o %t2.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t1.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+@a = common global i8 0, align 8
+
+; Shared library case, we merge @a as common and keep it for the symbol table.
+; CHECK: @a = common global i16 0, align 8
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: %t1.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s
+
+; All IR case, we internalize a after merging.
+; EXEC: @a = internal global i16 0, align 8
+
+; RUN: llc %p/Inputs/common.ll -o %t2.o -filetype=obj
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: %t1.o %t2.o -o %t3.o
+; 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 i8 0, align 8
--- /dev/null
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm -shared %p/Inputs/drop-debug.bc \
+; RUN: -o t2.bc 2>&1 | FileCheck %s
+
+; drop-debug.bc was created from "void f(void) {}" with clang 3.5 and
+; -gline-tables-only, so it contains old debug info.
+
+; CHECK: warning: LLVM gold plugin: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+
+; 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-nm %t3.o.o | FileCheck --check-prefix=NM %s
+
+; RUN: rm -f %t4.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: -m elf_x86_64 --plugin-opt=disable-output \
+; RUN: -shared %t.o -o %t4.o
+; RUN: not test -a %t4.o
+
+; NM: T f3
+
+target triple = "x86_64-unknown-linux-gnu"
+
+@g7 = extern_weak global i32
+; CHECK-DAG: @g7 = extern_weak global i32
+
+@g8 = external global i32
+
+; CHECK: define internal void @f1()
+; OPT-NOT: @f1
+define hidden void @f1() {
+ ret void
+}
+
+; CHECK: define hidden void @f2()
+; OPT: define hidden void @f2()
+define hidden void @f2() {
+ ret void
+}
+
+@llvm.used = appending global [1 x i8*] [ i8* bitcast (void ()* @f2 to i8*)]
+
+; CHECK: define void @f3()
+; OPT: define void @f3()
+define void @f3() {
+ call void @f4()
+ ret void
+}
+
+; CHECK: define internal void @f4()
+; OPT-NOT: @f4
+define linkonce_odr void @f4() {
+ ret void
+}
+
+; CHECK: define linkonce_odr void @f5()
+; OPT: define linkonce_odr void @f5()
+define linkonce_odr void @f5() {
+ ret void
+}
+@g5 = global void()* @f5
+
+; CHECK: define internal void @f6() unnamed_addr
+; OPT: define internal void @f6() unnamed_addr
+define linkonce_odr void @f6() unnamed_addr {
+ ret void
+}
+@g6 = global void()* @f6
+
+define i32* @f7() {
+ ret i32* @g7
+}
+
+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: g5 PREVAILING_DEF_IRONLY_EXP
+; API: g6 PREVAILING_DEF_IRONLY_EXP
--- /dev/null
+; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: %p/Inputs/invalid.bc -o %t2 2>&1 | FileCheck %s
+
+; test that only one error gets printed
+
+; CHECK: error: LLVM gold plugin has failed to create LTO module: Malformed block
+; CHECK-NOT: error
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o -o %t2.o \
+; RUN: -version-script=%p/Inputs/linker-script.export
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+; CHECK: define void @f()
+define void @f() {
+ ret void
+}
+
+; CHECK: define internal void @g()
+define void @g() {
+ ret void
+}
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/linkonce-weak.ll -o %t2.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t2.o %t.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+define linkonce_odr void @f() {
+ ret void
+}
+
+; Test that we get a weak_odr regardless of the order of the files
+; CHECK: define weak_odr void @f() {
--- /dev/null
+if (not 'ld_plugin' in config.available_features or
+ not 'X86' in config.root.targets):
+ config.unsupported = True
--- /dev/null
+; RUN: llvm-as -o %t.bc %s
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
+; RUN: --no-map-whole-files -r -o %t2.bc %t.bc
+; RUN: llvm-dis < %t2.bc -o - | FileCheck %s
+
+; CHECK: main
+define i32 @main() {
+ ret i32 0
+}
--- /dev/null
+; 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: %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: %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
+
+; CHECK-O0: define internal void @foo(
+; CHECK-O1: define internal void @foo(
+; CHECK-O2-NOT: define internal void @foo(
+define internal void @foo() {
+ ret void
+}
+
+; CHECK-O0: define internal i32 @bar(
+; CHECK-O1: define internal i32 @bar(
+define internal i32 @bar(i1 %p) {
+ br i1 %p, label %t, label %f
+
+t:
+ br label %end
+
+f:
+ br label %end
+
+end:
+ ; CHECK-O0: phi
+ ; CHECK-O1: select
+ %r = phi i32 [ 1, %t ], [ 2, %f ]
+ ret i32 %r
+}
+
+define void @baz() {
+ call void @foo()
+ %c = call i32 @bar(i1 true)
+ ret void
+}
+
+@a = constant i32 1
+
+!0 = !{!"bitset1", i32* @a, i32 0}
+
+; CHECK-O0-NOT: llvm.bitsets
+; CHECK-O1-NOT: llvm.bitsets
+; CHECK-O2-NOT: llvm.bitsets
+!llvm.bitsets = !{ !0 }
--- /dev/null
+; RUN: llc %s -o %t.o -filetype=obj -relocation-model=pic
+; RUN: llvm-as %p/Inputs/pr19901-1.ll -o %t2.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: -shared -m elf_x86_64 -o %t.so %t2.o %t.o
+; RUN: llvm-readobj -t %t.so | FileCheck %s
+
+; CHECK: Symbol {
+; CHECK: Name: f
+; CHECK-NEXT: Value:
+; CHECK-NEXT: Size:
+; CHECK-NEXT: Binding: Local
+; CHECK-NEXT: Type: Function
+; CHECK-NEXT: Other: {{2|0}}
+; CHECK-NEXT: Section: .text
+; CHECK-NEXT: }
+
+target triple = "x86_64-unknown-linux-gnu"
+define i32 @g() {
+ call void @f()
+ ret i32 0
+}
+define linkonce_odr hidden void @f() {
+ ret void
+}
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: -plugin-opt=-pass-remarks=inline %t.o -o %t2.o 2>&1 | FileCheck %s
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: %t.o -o %t2.o 2>&1 | FileCheck -allow-empty --check-prefix=NO-REMARK %s
+
+
+; CHECK: f inlined into _start
+; NO-REMARK-NOT: inlined
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @f() {
+ ret i32 0
+}
+
+define i32 @_start() {
+ %call = call i32 @f()
+ ret i32 %call
+}
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+
+; 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
+
+; test that the vectorizer is run.
+; CHECK: fadd <4 x float>
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f(float* nocapture %x) {
+ %tmp = load float, float* %x, align 4
+ %add = fadd float %tmp, 1.000000e+00
+ store float %add, float* %x, align 4
+ %arrayidx1 = getelementptr inbounds float, float* %x, i64 1
+ %tmp1 = load float, float* %arrayidx1, align 4
+ %add2 = fadd float %tmp1, 1.000000e+00
+ store float %add2, float* %arrayidx1, align 4
+ %arrayidx3 = getelementptr inbounds float, float* %x, i64 2
+ %tmp2 = load float, float* %arrayidx3, align 4
+ %add4 = fadd float %tmp2, 1.000000e+00
+ store float %add4, float* %arrayidx3, align 4
+ %arrayidx5 = getelementptr inbounds float, float* %x, i64 3
+ %tmp3 = load float, float* %arrayidx5, align 4
+ %add6 = fadd float %tmp3, 1.000000e+00
+ store float %add6, float* %arrayidx5, align 4
+ ret void
+}
--- /dev/null
+; REQUIRES: asserts
+
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -shared \
+; RUN: -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
+
+; CHECK: Statistics Collected
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+
+; 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
+
+; test that the vectorizer is run.
+; CHECK: fadd <4 x float>
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f(float* nocapture %x, i64 %n) {
+bb:
+ br label %bb1
+
+bb1:
+ %i.0 = phi i64 [ 0, %bb ], [ %tmp4, %bb1 ]
+ %tmp = getelementptr inbounds float, float* %x, i64 %i.0
+ %tmp2 = load float, float* %tmp, align 4
+ %tmp3 = fadd float %tmp2, 1.000000e+00
+ store float %tmp3, float* %tmp, align 4
+ %tmp4 = add nsw i64 %i.0, 1
+ %tmp5 = icmp slt i64 %tmp4, %n
+ br i1 %tmp5, label %bb1, label %bb6
+
+bb6:
+ ret void
+}
--- /dev/null
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/weak.ll -o %t2.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=emit-llvm \
+; RUN: -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+@a = weak global i32 42
+@b = global i32* @a
+
+; Test that @b and @c end up pointing to the same variable.
+
+; CHECK: @a = weak global i32 42
+; CHECK: @b = global i32* @a{{$}}
+; CHECK: @c = global i32* @a{{$}}
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/alias-1.ll -o %t2.o
-; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o \
-; RUN: -plugin-opt=emit-llvm
-; RUN: llvm-dis < %t3.o -o - | FileCheck %s
-
-; CHECK-NOT: alias
-; CHECK: @a = global i32 42
-; CHECK-NEXT: @b = global i32 1
-; CHECK-NOT: alias
-
-@a = weak alias i32* @b
-@b = global i32 1
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-
-; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: -shared %t.o -o %t2.o 2>&1 | FileCheck %s
-
-; CHECK: Unable to determine comdat of alias!
-
-@g1 = global i32 1
-@g2 = global i32 2
-
-@a = alias inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
- i32 ptrtoint (i32* @g2 to i32)) to i32*)
+++ /dev/null
-; RUN: llvm-as -o %T/bcsection.bc %s
-
-; RUN: llvm-mc -I=%T -filetype=obj -o %T/bcsection.bco %p/Inputs/bcsection.s
-; RUN: llvm-nm -no-llvm-bc %T/bcsection.bco | count 0
-; RUN: %gold -r -o %T/bcsection.o -plugin %llvmshlibdir/LLVMgold.so %T/bcsection.bco
-; RUN: llvm-nm -no-llvm-bc %T/bcsection.o | FileCheck %s
-
-; CHECK: main
-define i32 @main() {
- ret i32 0
-}
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
-; RUN: -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o -o - | FileCheck %s
-
-
-target datalayout = "m:w"
-
-; CHECK: define void @f() {
-define void @f() {
- ret void
-}
-
-; CHECK: define internal void @g() {
-define hidden void @g() {
- ret void
-}
-
-; CHECK: define internal void @h() {
-define linkonce_odr void @h() {
- ret void
-}
+++ /dev/null
-; RUN: llvm-as %s -o %t.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: -plugin-opt=emit-llvm
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-$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* @v1
-@a12 = alias bitcast (i32* @v1 to i16*)
-
-@a13 = alias i32 (i8*)* @f1
-@a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
-@a15 = alias i16* @a14
-
-; CHECK: $c1 = comdat any
-; CHECK: $c2 = comdat any
-
-; CHECK: @v1 = weak_odr global i32 42, comdat($c1)
-
-; CHECK: @r11 = global i32* @v1{{$}}
-; CHECK: @r12 = global i32 (i8*)* @f1{{$}}
-
-; CHECK: @r21 = global i32* @v1{{$}}
-; CHECK: @r22 = global i32 (i8*)* @f1{{$}}
-
-; CHECK: @v11 = internal global i32 41, comdat($c2)
-
-; CHECK: @a11 = alias i32* @v1{{$}}
-; CHECK: @a12 = alias bitcast (i32* @v1 to i16*)
-
-; CHECK: @a13 = alias i32 (i8*)* @f1{{$}}
-; CHECK: @a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
-
-; CHECK: @a21 = alias i32* @v11{{$}}
-; CHECK: @a22 = alias bitcast (i32* @v11 to i16*)
-
-; CHECK: @a23 = alias i32 (i8*)* @f12{{$}}
-; CHECK: @a24 = alias bitcast (i32 (i8*)* @f12 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 @f12(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: }
+++ /dev/null
-; RUN: llvm-as %s -o %t1.o
-; RUN: llvm-as %p/Inputs/common.ll -o %t2.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: -shared %t1.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-@a = common global i8 0, align 8
-
-; Shared library case, we merge @a as common and keep it for the symbol table.
-; CHECK: @a = common global i16 0, align 8
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: %t1.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s
-
-; All IR case, we internalize a after merging.
-; EXEC: @a = internal global i16 0, align 8
-
-; RUN: llc %p/Inputs/common.ll -o %t2.o -filetype=obj
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: %t1.o %t2.o -o %t3.o
-; 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 i8 0, align 8
+++ /dev/null
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm -shared %p/Inputs/drop-debug.bc \
-; RUN: -o t2.bc 2>&1 | FileCheck %s
-
-; drop-debug.bc was created from "void f(void) {}" with clang 3.5 and
-; -gline-tables-only, so it contains old debug info.
-
-; CHECK: warning: LLVM gold plugin: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-
-; 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-nm %t3.o.o | FileCheck --check-prefix=NM %s
-
-; RUN: rm -f %t4.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: -m elf_x86_64 --plugin-opt=disable-output \
-; RUN: -shared %t.o -o %t4.o
-; RUN: not test -a %t4.o
-
-; NM: T f3
-
-target triple = "x86_64-unknown-linux-gnu"
-
-@g7 = extern_weak global i32
-; CHECK-DAG: @g7 = extern_weak global i32
-
-@g8 = external global i32
-
-; CHECK: define internal void @f1()
-; OPT-NOT: @f1
-define hidden void @f1() {
- ret void
-}
-
-; CHECK: define hidden void @f2()
-; OPT: define hidden void @f2()
-define hidden void @f2() {
- ret void
-}
-
-@llvm.used = appending global [1 x i8*] [ i8* bitcast (void ()* @f2 to i8*)]
-
-; CHECK: define void @f3()
-; OPT: define void @f3()
-define void @f3() {
- call void @f4()
- ret void
-}
-
-; CHECK: define internal void @f4()
-; OPT-NOT: @f4
-define linkonce_odr void @f4() {
- ret void
-}
-
-; CHECK: define linkonce_odr void @f5()
-; OPT: define linkonce_odr void @f5()
-define linkonce_odr void @f5() {
- ret void
-}
-@g5 = global void()* @f5
-
-; CHECK: define internal void @f6() unnamed_addr
-; OPT: define internal void @f6() unnamed_addr
-define linkonce_odr void @f6() unnamed_addr {
- ret void
-}
-@g6 = global void()* @f6
-
-define i32* @f7() {
- ret i32* @g7
-}
-
-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: g5 PREVAILING_DEF_IRONLY_EXP
-; API: g6 PREVAILING_DEF_IRONLY_EXP
+++ /dev/null
-; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: %p/Inputs/invalid.bc -o %t2 2>&1 | FileCheck %s
-
-; test that only one error gets printed
-
-; CHECK: error: LLVM gold plugin has failed to create LTO module: Malformed block
-; CHECK-NOT: error
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: -shared %t.o -o %t2.o \
-; RUN: -version-script=%p/Inputs/linker-script.export
-; RUN: llvm-dis %t2.o -o - | FileCheck %s
-
-; CHECK: define void @f()
-define void @f() {
- ret void
-}
-
-; CHECK: define internal void @g()
-define void @g() {
- ret void
-}
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/linkonce-weak.ll -o %t2.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: -shared %t.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: -shared %t2.o %t.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-define linkonce_odr void @f() {
- ret void
-}
-
-; Test that we get a weak_odr regardless of the order of the files
-; CHECK: define weak_odr void @f() {
+++ /dev/null
-if (not 'ld_plugin' in config.available_features or
- not 'X86' in config.root.targets or
- not 'PowerPC' in config.root.targets):
- config.unsupported = True
+++ /dev/null
-; REQUIRES: ld_emu_elf32ppc
-
-; RUN: llvm-as %s -o %t.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -m elf32ppc \
-; RUN: -plugin-opt=mtriple=powerpc-linux-gnu \
-; RUN: -plugin-opt=obj-path=%t3.o \
-; RUN: -shared %t.o -o %t2
-; RUN: llvm-readobj --file-headers %t2 | FileCheck --check-prefix=DSO %s
-; RUN: llvm-readobj --file-headers %t3.o | FileCheck --check-prefix=REL %s
-
-; REL: Type: Relocatable
-; REL-NEXT: Machine: EM_PPC
-
-; DSO: Type: SharedObject
-; DSO-NEXT: Machine: EM_PPC
+++ /dev/null
-; RUN: llvm-as -o %t.bc %s
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
-; RUN: --no-map-whole-files -r -o %t2.bc %t.bc
-; RUN: llvm-dis < %t2.bc -o - | FileCheck %s
-
-; CHECK: main
-define i32 @main() {
- ret i32 0
-}
+++ /dev/null
-; 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: %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: %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
-
-; CHECK-O0: define internal void @foo(
-; CHECK-O1: define internal void @foo(
-; CHECK-O2-NOT: define internal void @foo(
-define internal void @foo() {
- ret void
-}
-
-; CHECK-O0: define internal i32 @bar(
-; CHECK-O1: define internal i32 @bar(
-define internal i32 @bar(i1 %p) {
- br i1 %p, label %t, label %f
-
-t:
- br label %end
-
-f:
- br label %end
-
-end:
- ; CHECK-O0: phi
- ; CHECK-O1: select
- %r = phi i32 [ 1, %t ], [ 2, %f ]
- ret i32 %r
-}
-
-define void @baz() {
- call void @foo()
- %c = call i32 @bar(i1 true)
- ret void
-}
-
-@a = constant i32 1
-
-!0 = !{!"bitset1", i32* @a, i32 0}
-
-; CHECK-O0-NOT: llvm.bitsets
-; CHECK-O1-NOT: llvm.bitsets
-; CHECK-O2-NOT: llvm.bitsets
-!llvm.bitsets = !{ !0 }
+++ /dev/null
-; RUN: llc %s -o %t.o -filetype=obj -relocation-model=pic
-; RUN: llvm-as %p/Inputs/pr19901-1.ll -o %t2.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: -shared -m elf_x86_64 -o %t.so %t2.o %t.o
-; RUN: llvm-readobj -t %t.so | FileCheck %s
-
-; CHECK: Symbol {
-; CHECK: Name: f
-; CHECK-NEXT: Value:
-; CHECK-NEXT: Size:
-; CHECK-NEXT: Binding: Local
-; CHECK-NEXT: Type: Function
-; CHECK-NEXT: Other: {{2|0}}
-; CHECK-NEXT: Section: .text
-; CHECK-NEXT: }
-
-target triple = "x86_64-unknown-linux-gnu"
-define i32 @g() {
- call void @f()
- ret i32 0
-}
-define linkonce_odr hidden void @f() {
- ret void
-}
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: -plugin-opt=-pass-remarks=inline %t.o -o %t2.o 2>&1 | FileCheck %s
-
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: %t.o -o %t2.o 2>&1 | FileCheck -allow-empty --check-prefix=NO-REMARK %s
-
-
-; CHECK: f inlined into _start
-; NO-REMARK-NOT: inlined
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define i32 @f() {
- ret i32 0
-}
-
-define i32 @_start() {
- %call = call i32 @f()
- ret i32 %call
-}
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-
-; 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
-
-; test that the vectorizer is run.
-; CHECK: fadd <4 x float>
-
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @f(float* nocapture %x) {
- %tmp = load float, float* %x, align 4
- %add = fadd float %tmp, 1.000000e+00
- store float %add, float* %x, align 4
- %arrayidx1 = getelementptr inbounds float, float* %x, i64 1
- %tmp1 = load float, float* %arrayidx1, align 4
- %add2 = fadd float %tmp1, 1.000000e+00
- store float %add2, float* %arrayidx1, align 4
- %arrayidx3 = getelementptr inbounds float, float* %x, i64 2
- %tmp2 = load float, float* %arrayidx3, align 4
- %add4 = fadd float %tmp2, 1.000000e+00
- store float %add4, float* %arrayidx3, align 4
- %arrayidx5 = getelementptr inbounds float, float* %x, i64 3
- %tmp3 = load float, float* %arrayidx5, align 4
- %add6 = fadd float %tmp3, 1.000000e+00
- store float %add6, float* %arrayidx5, align 4
- ret void
-}
+++ /dev/null
-; REQUIRES: asserts
-
-; RUN: llvm-as %s -o %t.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -shared \
-; RUN: -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
-
-; CHECK: Statistics Collected
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-
-; 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
-
-; test that the vectorizer is run.
-; CHECK: fadd <4 x float>
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @f(float* nocapture %x, i64 %n) {
-bb:
- br label %bb1
-
-bb1:
- %i.0 = phi i64 [ 0, %bb ], [ %tmp4, %bb1 ]
- %tmp = getelementptr inbounds float, float* %x, i64 %i.0
- %tmp2 = load float, float* %tmp, align 4
- %tmp3 = fadd float %tmp2, 1.000000e+00
- store float %tmp3, float* %tmp, align 4
- %tmp4 = add nsw i64 %i.0, 1
- %tmp5 = icmp slt i64 %tmp4, %n
- br i1 %tmp5, label %bb1, label %bb6
-
-bb6:
- ret void
-}
+++ /dev/null
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/weak.ll -o %t2.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN: --plugin-opt=emit-llvm \
-; RUN: -shared %t.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-@a = weak global i32 42
-@b = global i32* @a
-
-; Test that @b and @c end up pointing to the same variable.
-
-; CHECK: @a = weak global i32 42
-; CHECK: @b = global i32* @a{{$}}
-; CHECK: @c = global i32* @a{{$}}