Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / runtime / X86 / unclaimed-jt-entries.s
blobd0691d256ba04580c5cbee2b2f068a21f7cb337a
1 # This test ensures that "unclaimed" jump table entries are accounted later
2 # in postProcessIndirectBranches and the function is marked as non-simple.
4 # The test is compiled from the following source using GCC 12.2 -O3:
5 # https://godbolt.org/z/YcPG131s6
6 # int func(long long Input) {
7 # switch(Input) {
8 # case 3: return 1;
9 # case 4: return 2;
10 # case 6: return 3;
11 # case 8: return 4;
12 # case 13: return 5;
13 # default: __builtin_unreachable();
14 # }
15 # }
17 # REQUIRES: system-linux
19 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
20 # RUN: %clang %cflags %S/Inputs/unclaimed-jt-entries.c -no-pie %t.o -o %t.exe -Wl,-q
21 # RUN: llvm-bolt %t.exe -v=1 -o %t.out --sequential-disassembly |& FileCheck %s
23 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func
24 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func
25 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func
26 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func
27 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func
28 # CHECK: BOLT-WARNING: failed to post-process indirect branches for func
30 # Run the optimized binary
31 # RUN: %t.out 3 | FileCheck %s --check-prefix=CHECK3
32 # CHECK3: 1
33 # RUN: %t.out 4 | FileCheck %s --check-prefix=CHECK4
34 # CHECK4: 2
35 # RUN: %t.out 6 | FileCheck %s --check-prefix=CHECK6
36 # CHECK6: 3
37 # RUN: %t.out 8 | FileCheck %s --check-prefix=CHECK8
38 # CHECK8: 4
39 # RUN: %t.out 13 | FileCheck %s --check-prefix=CHECK13
40 # CHECK13: 5
42 .text
43 .globl func
44 .type func, %function
45 .size func, .Lend-func
46 func:
47 jmp *L4-24(,%rdi,8)
48 .L5:
49 movl $4, %eax
50 ret
51 .L9:
52 movl $2, %eax
53 ret
54 .L8:
55 movl $1, %eax
56 ret
57 .L3:
58 movl $5, %eax
59 ret
60 .L6:
61 movl $3, %eax
62 ret
63 .Lend:
65 .section .rodata
66 .globl L4
67 L4:
68 .quad .L8
69 .quad .L9
70 .quad .L3
71 .quad .L6
72 .quad .L3
73 .quad .L5
74 .quad .L3
75 .quad .L3
76 .quad .L3
77 .quad .L3
78 .quad .L3