File: wrap-lto-2.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (85 lines) | stat: -rw-r--r-- 3,259 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
; REQUIRES: x86
; RUN: split-file %s %t.dir
;; LTO
; RUN: llvm-as %t.dir/main.ll -o %t.main.bc
; RUN: llvm-as %t.dir/wrap.ll -o %t.wrap.bc
; RUN: llvm-as %t.dir/other.ll -o %t.other.bc
; RUN: rm -f %t.bc.lib
; RUN: llvm-ar rcs %t.bc.lib %t.wrap.bc %t.other.bc
;; ThinLTO
; RUN: opt -module-summary %t.dir/main.ll -o %t.main.thin
; RUN: opt -module-summary %t.dir/wrap.ll -o %t.wrap.thin
; RUN: opt -module-summary %t.dir/other.ll -o %t.other.thin
; RUN: rm -f %t.thin.lib
; RUN: llvm-ar rcs %t.thin.lib %t.wrap.thin %t.other.thin
;; Object
; RUN: llc %t.dir/main.ll -o %t.main.obj --filetype=obj
; RUN: llc %t.dir/wrap.ll -o %t.wrap.obj --filetype=obj
; RUN: llc %t.dir/other.ll -o %t.other.obj --filetype=obj
; RUN: rm -f %t.obj.lib
; RUN: llvm-ar rcs %t.obj.lib %t.wrap.obj %t.other.obj

;; This test verifies that -wrap works correctly for inter-module references to
;; the wrapped symbol, when LTO or ThinLTO is involved. It checks for various
;; combinations of bitcode and regular objects.

;; LTO + LTO
; RUN: lld-link -out:%t.bc-bc.exe %t.main.bc -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.bc-bc.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; LTO + Object
; RUN: lld-link -out:%t.bc-obj.exe %t.main.bc -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.bc-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; Object + LTO
; RUN: lld-link -out:%t.obj-bc.exe %t.main.obj -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.obj-bc.exe | FileCheck %s --check-prefixes=CHECK,CALL

;; ThinLTO + ThinLTO
; RUN: lld-link -out:%t.thin-thin.exe %t.main.thin -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.thin-thin.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; ThinLTO + Object
; RUN: lld-link -out:%t.thin-obj.exe %t.main.thin -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.thin-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; Object + ThinLTO
; RUN: lld-link -out:%t.obj-thin.exe %t.main.obj -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.obj-thin.exe | FileCheck %s --check-prefixes=CHECK,CALL

;; Make sure that calls in entry() are not eliminated and that bar is
;; routed to __wrap_bar.

; CHECK: <entry>:
; JMP: jmp {{.*}}<__wrap_bar>
; CALL: callq {{.*}}<__wrap_bar>

;--- main.ll
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-w64-windows-gnu"

declare void @bar()

define void @entry() {
  call void @bar()
  ret void
}

;--- wrap.ll
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-w64-windows-gnu"

declare void @other()

define void @__wrap_bar() {
  call void @other()
  ret void
}

;--- other.ll
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-w64-windows-gnu"

define void @other() {
  ret void
}