]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/lto/defsym.ll
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / lto / defsym.ll
1 ; REQUIRES: x86
2 ; LTO
3 ; RUN: llvm-as %s -o %t.o
4 ; RUN: llvm-as %S/Inputs/defsym-bar.ll -o %t1.o
5 ; RUN: ld.lld %t.o %t1.o -shared -o %t.so -defsym=bar2=bar3 -save-temps
6 ; RUN: llvm-readelf -t %t.so.lto.o | FileCheck --check-prefix=OBJ %s
7 ; RUN: llvm-objdump -d %t.so | FileCheck %s
8
9 ; ThinLTO
10 ; RUN: opt -module-summary %s -o %t.o
11 ; RUN: opt -module-summary %S/Inputs/defsym-bar.ll -o %t1.o
12 ; RUN: ld.lld %t.o %t1.o -shared -o %t2.so -defsym=bar2=bar3 -save-temps
13 ; RUN: llvm-readelf -t %t2.so1.lto.o | FileCheck --check-prefix=OBJ %s
14 ; RUN: llvm-objdump -d %t2.so | FileCheck %s --check-prefix=THIN
15
16 ; OBJ:  UND bar2
17
18 ; Call to bar2() should not be inlined and should be routed to bar3()
19 ; Symbol bar3 should not be eliminated
20
21 ; CHECK:      foo:
22 ; CHECK-NEXT: pushq     %rax
23 ; CHECK-NEXT: callq
24 ; CHECK-NEXT: callq{{.*}}<bar3>
25 ; CHECK-NEXT: callq
26
27 ; THIN:       foo
28 ; THIN-NEXT:  pushq %rax
29 ; THIN-NEXT:  callq
30 ; THIN-NEXT:  callq{{.*}}<bar3>
31 ; THIN-NEXT:  popq %rax
32 ; THIN-NEXT:  jmp
33
34 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
35 target triple = "x86_64-unknown-linux-gnu"
36
37 declare void @bar1()
38 declare void @bar2()
39 declare void @bar3()
40
41 define void @foo() {
42   call void @bar1()
43   call void @bar2()
44   call void @bar3()
45   ret void
46 }