Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / unclaimed-jt-entries.s
blob454de7e1b30b7db962334fd0ff33560b887307fa
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 -no-pie %t.o -o %t.exe -Wl,-q
21 # RUN: llvm-bolt %t.exe -v=1 -o %t.out |& FileCheck %s
23 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
24 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
25 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
26 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
27 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
28 # CHECK: BOLT-WARNING: failed to post-process indirect branches for main
30 .text
31 .globl main
32 .type main, %function
33 .size main, .Lend-main
34 main:
35 jmp *L4-24(,%rdi,8)
36 .L5:
37 movl $4, %eax
38 ret
39 .L9:
40 movl $2, %eax
41 ret
42 .L8:
43 movl $1, %eax
44 ret
45 .L3:
46 movl $5, %eax
47 ret
48 .L6:
49 movl $3, %eax
50 ret
51 .Lend:
53 .section .rodata
54 .globl L4
55 L4:
56 .quad .L8
57 .quad .L9
58 .quad .L3
59 .quad .L6
60 .quad .L3
61 .quad .L5
62 .quad .L3
63 .quad .L3
64 .quad .L3
65 .quad .L3
66 .quad .L3