236
|
1 # This reproduces a bug in tail duplication when aggressiveCodeToDuplicate
|
|
2 # fails to handle a block with a jump table.
|
|
3
|
|
4 # REQUIRES: system-linux
|
|
5
|
|
6 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
|
|
7 # RUN: %s -o %t.o
|
|
8 # RUN: link_fdata %s %t.o %t.fdata
|
|
9 # RUN: llvm-strip --strip-unneeded %t.o
|
|
10 # RUN: %clangxx %cflags -no-pie %t.o -o %t.exe -Wl,-q
|
|
11 # RUN: llvm-bolt %t.exe -o %t.out --data %t.fdata --relocs \
|
|
12 # RUN: --tail-duplication=aggressive \
|
|
13 # RUN: --print-cfg | FileCheck %s
|
|
14 # CHECK: Jump table {{.*}} for function a at {{.*}} with a total count of 3
|
|
15 .globl main
|
|
16 main:
|
|
17 .globl a
|
|
18 .type a, %function
|
|
19 a:
|
|
20 .cfi_startproc
|
|
21 b:
|
|
22 jmp c
|
|
23 je b
|
|
24 movl %esi, %edi
|
|
25 c:
|
|
26 movb 0, %cl
|
|
27 d:
|
|
28 jmp e
|
|
29 movq 0, %r14
|
|
30 f:
|
|
31 je d
|
|
32 jmp f
|
|
33 e:
|
|
34 g:
|
|
35 j:
|
|
36 movq %rbp, 0
|
|
37 h:
|
|
38 cmpl $0x41, 0
|
|
39 i:
|
|
40 jmp h
|
|
41 jmp i
|
|
42 ja o
|
|
43 movl %edx, 0
|
|
44 p:
|
|
45 q:
|
|
46 k:
|
|
47 jmpq *JT0(,%rcx,8)
|
|
48 # FDATA: 1 a #k# 1 a #l# 1 3
|
|
49 m:
|
|
50 movl 0, %esi
|
|
51 r:
|
|
52 jmpq *JT1(,%rax,8)
|
|
53 cmpl 1, %eax
|
|
54 jmp j
|
|
55 l:
|
|
56 jmp m
|
|
57 s:
|
|
58 movl 6, %ebx
|
|
59 ak:
|
|
60 jmp e
|
|
61 movl 0, %eax
|
|
62 am:
|
|
63 jmp p
|
|
64 jmp q
|
|
65 o:
|
|
66 jmp g
|
|
67 n:
|
|
68 xorl %r12d, %r12d
|
|
69 .cfi_endproc
|
|
70 .rodata
|
|
71 JT0:
|
|
72 .quad r
|
|
73 .quad l
|
|
74 .quad ak
|
|
75 JT1:
|
|
76 .quad s
|
|
77 .quad am
|
|
78 .quad n
|