Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / basic-block-sections-and-icf.s
blob998d63b47b01cef3226ce57de189dfa887f91762
1 # REQUIRES: x86
2 ## basic-block-sections tests.
3 ## This simple test checks foo is folded into bar with bb sections
4 ## and the jumps are deleted.
6 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
7 # RUN: ld.lld --optimize-bb-jumps --icf=all %t.o -o %t.out
8 # RUN: llvm-objdump -d %t.out| FileCheck %s
10 # CHECK: <foo>:
11 # CHECK-NEXT: nopl (%rax)
12 # CHECK-NEXT: je 0x{{[[:xdigit:]]+}} <aa.BB.foo>
13 # CHECK-NOT: jmp
15 # CHECK: <a.BB.foo>:
16 ## Explicity check that bar is folded and not emitted.
17 # CHECK-NOT: <bar>:
18 # CHECK-NOT: <a.BB.bar>:
19 # CHECK-NOT: <aa.BB.bar>:
21 .section .text.bar,"ax",@progbits
22 .type bar,@function
23 bar:
24 nopl (%rax)
25 jne a.BB.bar
26 jmp aa.BB.bar
28 .section .text.a.BB.bar,"ax",@progbits,unique,3
29 a.BB.bar:
30 nopl (%rax)
32 aa.BB.bar:
33 ret
35 .section .text.foo,"ax",@progbits
36 .type foo,@function
37 foo:
38 nopl (%rax)
39 jne a.BB.foo
40 jmp aa.BB.foo
42 .section .text.a.BB.foo,"ax",@progbits,unique,2
43 a.BB.foo:
44 nopl (%rax)
46 aa.BB.foo:
47 ret