[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / basic-block-sections-delete-fallthru.s
blobb029e664a1e12493b38abd933a66a4ba1e44d2e1
1 # REQUIRES: x86
2 ## basic-block-sections tests.
3 ## This simple test checks if redundant direct jumps are converted to
4 ## implicit fallthrus. The jcc's must be converted to their inverted
5 ## opcode, for instance jne to je and jmp must be deleted.
7 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
8 # RUN: ld.lld --optimize-bb-jumps %t.o -o %t.out
9 # RUN: llvm-objdump -d %t.out| FileCheck %s
11 # CHECK: <foo>:
12 # CHECK-NEXT: nopl (%rax)
13 # CHECK-NEXT: jne 0x{{[[:xdigit:]]+}} <r.BB.foo>
14 # CHECK-NOT: jmp
17 .section .text,"ax",@progbits
18 .type foo,@function
19 foo:
20 nopl (%rax)
21 je a.BB.foo
22 jmp r.BB.foo
24 # CHECK: <a.BB.foo>:
25 # CHECK-NEXT: nopl (%rax)
26 # CHECK-NEXT: je 0x{{[[:xdigit:]]+}} <r.BB.foo>
27 # CHECK-NOT: jmp
29 .section .text,"ax",@progbits,unique,3
30 a.BB.foo:
31 nopl (%rax)
32 jne aa.BB.foo
33 jmp r.BB.foo
35 # CHECK: <aa.BB.foo>:
36 # CHECK-NEXT: nopl (%rax)
37 # CHECK-NEXT: jle 0x{{[[:xdigit:]]+}} <r.BB.foo>
38 # CHECK-NOT: jmp
40 .section .text,"ax",@progbits,unique,4
41 aa.BB.foo:
42 nopl (%rax)
43 jg aaa.BB.foo
44 jmp r.BB.foo
46 # CHECK: <aaa.BB.foo>:
47 # CHECK-NEXT: nopl (%rax)
48 # CHECK-NEXT: jl 0x{{[[:xdigit:]]+}} <r.BB.foo>
49 # CHECK-NOT: jmp
51 .section .text,"ax",@progbits,unique,5
52 aaa.BB.foo:
53 nopl (%rax)
54 jge aaaa.BB.foo
55 jmp r.BB.foo
57 # CHECK: <aaaa.BB.foo>:
58 # CHECK-NEXT: nopl (%rax)
59 # CHECK-NEXT: jae 0x{{[[:xdigit:]]+}} <r.BB.foo>
60 # CHECK-NOT: jmp
62 .section .text,"ax",@progbits,unique,6
63 aaaa.BB.foo:
64 nopl (%rax)
65 jb aaaaa.BB.foo
66 jmp r.BB.foo
68 # CHECK: <aaaaa.BB.foo>:
69 # CHECK-NEXT: nopl (%rax)
70 # CHECK-NEXT: ja 0x{{[[:xdigit:]]+}} <r.BB.foo>
71 # CHECK-NOT: jmp
73 .section .text,"ax",@progbits,unique,7
74 aaaaa.BB.foo:
75 nopl (%rax)
76 jbe aaaaaa.BB.foo
77 jmp r.BB.foo
79 # CHECK: <aaaaaa.BB.foo>:
80 # CHECK-NEXT: nopl (%rax)
81 # CHECK-NEXT: jge 0x{{[[:xdigit:]]+}} <r.BB.foo>
82 # CHECK-NOT: jmp
84 .section .text,"ax",@progbits,unique,8
85 aaaaaa.BB.foo:
86 nopl (%rax)
87 jl aaaaaaa.BB.foo
88 jmp r.BB.foo
90 # CHECK: <aaaaaaa.BB.foo>:
91 # CHECK-NEXT: nopl (%rax)
92 # CHECK-NEXT: jg 0x{{[[:xdigit:]]+}} <r.BB.foo>
93 # CHECK-NOT: jmp
95 .section .text,"ax",@progbits,unique,9
96 aaaaaaa.BB.foo:
97 nopl (%rax)
98 jle aaaaaaaa.BB.foo
99 jmp r.BB.foo
101 # CHECK: <aaaaaaaa.BB.foo>:
102 # CHECK-NEXT: nopl (%rax)
103 # CHECK-NEXT: jbe 0x{{[[:xdigit:]]+}} <r.BB.foo>
104 # CHECK-NOT: jmp
106 .section .text,"ax",@progbits,unique,10
107 aaaaaaaa.BB.foo:
108 nopl (%rax)
109 ja aaaaaaaaa.BB.foo
110 jmp r.BB.foo
112 # CHECK: <aaaaaaaaa.BB.foo>:
113 # CHECK-NEXT: nopl (%rax)
114 # CHECK-NEXT: jb 0x{{[[:xdigit:]]+}} <r.BB.foo>
115 # CHECK-NOT: jmp
117 .section .text,"ax",@progbits,unique,11
118 aaaaaaaaa.BB.foo:
119 nopl (%rax)
120 jae aaaaaaaaaa.BB.foo
121 jmp r.BB.foo
123 .section .text,"ax",@progbits,unique,20
124 aaaaaaaaaa.BB.foo:
125 nopl (%rax)
127 r.BB.foo: