Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / jump-table-func-entry.s
blob77b444d520a1f105c86c6ea8f5210e29bc3a847e
1 # REQUIRES: system-linux
3 ## Check that BOLT correctly processes jump table that contains function start
4 ## as one of its entries.
6 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
7 # RUN: %clang %cflags %t.o -o %t.exe -no-pie -Wl,-q
9 # RUN: llvm-bolt %t.exe --print-normalized --print-only=foo -o %t.out \
10 # RUN: |& FileCheck %s
14 .text
15 .globl _start
16 .type _start, %function
17 _start:
18 .cfi_startproc
19 call foo
20 ret
21 .cfi_endproc
22 .size _start, .-_start
24 .globl foo
25 .type foo, %function
26 foo:
27 .cfi_startproc
28 .LBB00:
29 movq 0x8(%rdi), %rdi
30 movzbl 0x1(%rdi), %eax
31 .LBB00_br:
32 jmpq *"JUMP_TABLE/foo.0"(,%rax,8)
33 # CHECK: jmpq {{.*}} # JUMPTABLE
34 # CHECK-NEXT: Successors: {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}}
36 .Ltmp87085:
37 xorl %eax, %eax
38 retq
40 .Ltmp87086:
41 cmpb $0x0, 0x8(%rdi)
42 setne %al
43 retq
45 .Ltmp87088:
46 movb $0x1, %al
47 retq
49 .Ltmp87087:
50 movzbl 0x14(%rdi), %eax
51 andb $0x2, %al
52 shrb %al
53 retq
55 .cfi_endproc
56 .size foo, .-foo
58 # Jump tables
59 .section .rodata
60 "JUMP_TABLE/foo.0":
61 .quad .Ltmp87085
62 .quad .Ltmp87086
63 .quad .Ltmp87087
64 .quad .LBB00
65 .quad .Ltmp87088
67 # CHECK: Jump table {{.*}} for function foo
68 # CHECK-NEXT: 0x{{.*}} :
69 # CHECK-NEXT: 0x{{.*}} :
70 # CHECK-NEXT: 0x{{.*}} :
71 # CHECK-NEXT: 0x{{.*}} :
72 # CHECK-NEXT: 0x{{.*}} :