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. 5 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 9 10# CHECK: <foo>: 11# CHECK-NEXT: nopl (%rax) 12# CHECK-NEXT: je 0x{{[[:xdigit:]]+}} <aa.BB.foo> 13# CHECK-NOT: jmp 14 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>: 20 21.section .text.bar,"ax",@progbits 22.type bar,@function 23bar: 24 nopl (%rax) 25 jne a.BB.bar 26 jmp aa.BB.bar 27 28.section .text.a.BB.bar,"ax",@progbits,unique,3 29a.BB.bar: 30 nopl (%rax) 31 32aa.BB.bar: 33 ret 34 35.section .text.foo,"ax",@progbits 36.type foo,@function 37foo: 38 nopl (%rax) 39 jne a.BB.foo 40 jmp aa.BB.foo 41 42.section .text.a.BB.foo,"ax",@progbits,unique,2 43a.BB.foo: 44 nopl (%rax) 45 46aa.BB.foo: 47 ret 48