1 # This reproduces an issue where two cold fragments are folded into one, so the
2 # fragment has two parents.
3 # The fragment is only reachable through a jump table, so all functions must be
6 # REQUIRES: system-linux
8 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
9 # RUN: llvm-strip --strip-unneeded %t.o
10 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
11 # RUN: llvm-bolt %t.exe -o %t.out -v=1 --print-only=main2.cold.1 --print-disasm 2>&1 | FileCheck %s
13 # CHECK-NOT: unclaimed PC-relative relocations left in data
14 # CHECK-DAG: BOLT-INFO: marking main2.cold.1(*2) as a fragment of main2
15 # CHECK-DAG: BOLT-INFO: marking main2.cold.1(*2) as a fragment of main
16 # CHECK: Binary Function "main2.cold.1(*2)" after disassembly
17 # CHECK: End of Function "main2.cold.1(*2)"
18 # CHECK-DAG: BOLT-WARNING: Ignoring main2
19 # CHECK-DAG: BOLT-WARNING: Ignoring main
20 # CHECK-DAG: BOLT-WARNING: Ignoring main2.cold.1(*2)
21 # CHECK: BOLT-WARNING: skipped 3 functions due to cold fragments
33 # jump table dispatch, jumping to label indexed by val in %ecx
35 leaq JUMP_TABLE1
(%rip
), %r8
37 movslq
(%r8,%rcx
,4), %rax
49 .type main2, %function
58 # jump table dispatch, jumping to label indexed by val in %ecx
60 leaq JUMP_TABLE2
(%rip
), %r8
62 movslq
(%r8,%rcx
,4), %rax
73 # cold fragment is only reachable through jump table
75 .type main2.cold.1, %function
78 .type main.cold.1, %function
81 # load bearing nop: pad LBB4 so that it can't be treated
82 # as __builtin_unreachable by analyzeJumpTable
86 .size main.cold.1, .-main.cold.1
89 # jmp table, entries must be R_X86_64_PC32 relocs
92 .long LBB2-JUMP_TABLE1
93 .long LBB3-JUMP_TABLE1
94 .long LBB4-JUMP_TABLE1
95 .long LBB3-JUMP_TABLE1
99 .long LBB22-JUMP_TABLE2
100 .long LBB23-JUMP_TABLE2
101 .long LBB4-JUMP_TABLE2
102 .long LBB23-JUMP_TABLE2