File: basic-block-sections-delete-fallthru.s

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 (128 lines) | stat: -rw-r--r-- 2,752 bytes parent folder | download | duplicates (21)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# REQUIRES: x86
## basic-block-sections tests.
## This simple test checks if redundant direct jumps are converted to
## implicit fallthrus.  The jcc's must be converted to their inverted
## opcode, for instance jne to je and jmp must be deleted.

# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
# RUN: ld.lld  --optimize-bb-jumps %t.o -o %t.out
# RUN: llvm-objdump -d %t.out| FileCheck %s

# CHECK:      <foo>:
# CHECK-NEXT:  nopl    (%rax)
# CHECK-NEXT:  jne      0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp


.section	.text,"ax",@progbits
.type	foo,@function
foo:
 nopl (%rax)
 je	a.BB.foo
 jmp	r.BB.foo

# CHECK:      <a.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  je 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp

.section	.text,"ax",@progbits,unique,3
a.BB.foo:
 nopl (%rax)
 jne	aa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  jle 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,4
aa.BB.foo:
 nopl (%rax)
 jg	aaa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aaa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  jl 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,5
aaa.BB.foo:
 nopl (%rax)
 jge	aaaa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aaaa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  jae 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,6
aaaa.BB.foo:
 nopl (%rax)
 jb	aaaaa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aaaaa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  ja 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,7
aaaaa.BB.foo:
 nopl (%rax)
 jbe	aaaaaa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aaaaaa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  jge 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,8
aaaaaa.BB.foo:
 nopl (%rax)
 jl	aaaaaaa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aaaaaaa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  jg 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,9
aaaaaaa.BB.foo:
 nopl (%rax)
 jle	aaaaaaaa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aaaaaaaa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  jbe 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,10
aaaaaaaa.BB.foo:
 nopl (%rax)
 ja	aaaaaaaaa.BB.foo
 jmp	r.BB.foo

# CHECK:      <aaaaaaaaa.BB.foo>:
# CHECK-NEXT:  nopl (%rax)
# CHECK-NEXT:  jb 0x{{[[:xdigit:]]+}} <r.BB.foo>
# CHECK-NOT:   jmp
#
.section	.text,"ax",@progbits,unique,11
aaaaaaaaa.BB.foo:
 nopl (%rax)
 jae	aaaaaaaaaa.BB.foo
 jmp	r.BB.foo

.section	.text,"ax",@progbits,unique,20
aaaaaaaaaa.BB.foo:
 nopl (%rax)

r.BB.foo:
 ret