brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · a87c52c Raw
103 lines · plain
1## This reproduces an issue where two cold fragments are folded into one, so the2## fragment has two parents.3## The fragment is only reachable through a jump table, so all functions must be4## ignored.5 6# REQUIRES: system-linux7 8# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o9# RUN: llvm-strip --strip-unneeded %t.o10# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q11# RUN: llvm-bolt %t.exe -o %t.out -v=1 --print-only=main2.cold.1 --print-disasm 2>&1 | FileCheck %s12 13# CHECK-NOT: unclaimed PC-relative relocations left in data14# CHECK-DAG: BOLT-INFO: marking main2.cold.1(*2) as a fragment of main215# CHECK-DAG: BOLT-INFO: marking main2.cold.1(*2) as a fragment of main16# CHECK: Binary Function "main2.cold.1(*2)" after disassembly17# CHECK: End of Function "main2.cold.1(*2)"18# CHECK-DAG: BOLT-WARNING: Ignoring main219# CHECK-DAG: BOLT-WARNING: Ignoring main20# CHECK-DAG: BOLT-WARNING: Ignoring main2.cold.1(*2)21# CHECK: BOLT-WARNING: skipped 3 functions due to cold fragments22  .text23  .globl main24  .type main, %function25  .p2align 226main:27LBB0:28  andl $0xf, %ecx29  cmpb $0x4, %cl30  ## exit through ret31  ja LBB332 33## jump table dispatch, jumping to label indexed by val in %ecx34LBB1:35  leaq JUMP_TABLE1(%rip), %r836  movzbl %cl, %ecx37  movslq (%r8,%rcx,4), %rax38  addq %rax, %r839  jmpq *%r840 41LBB2:42  xorq %rax, %rax43LBB3:44  addq $0x8, %rsp45  ret46.size main, .-main47 48  .globl main249  .type main2, %function50  .p2align 251main2:52LBB20:53  andl $0xb, %ebx54  cmpb $0x1, %cl55  # exit through ret56  ja LBB2357 58## jump table dispatch, jumping to label indexed by val in %ecx59LBB21:60  leaq JUMP_TABLE2(%rip), %r861  movzbl %cl, %ecx62  movslq (%r8,%rcx,4), %rax63  addq %rax, %r864  jmpq *%r865 66LBB22:67  xorq %rax, %rax68LBB23:69  addq $0x8, %rsp70  ret71.size main2, .-main272 73## cold fragment is only reachable through jump table74  .globl main2.cold.175  .type main2.cold.1, %function76main2.cold.1:77  .globl main.cold.178  .type main.cold.1, %function79  .p2align 280main.cold.1:81  ## load bearing nop: pad LBB4 so that it can't be treated82  ## as __builtin_unreachable by analyzeJumpTable83  nop84LBB4:85  callq abort86.size main.cold.1, .-main.cold.187 88  .rodata89## jmp table, entries must be R_X86_64_PC32 relocs90  .globl JUMP_TABLE191JUMP_TABLE1:92  .long LBB2-JUMP_TABLE193  .long LBB3-JUMP_TABLE194  .long LBB4-JUMP_TABLE195  .long LBB3-JUMP_TABLE196 97  .globl JUMP_TABLE298JUMP_TABLE2:99  .long LBB22-JUMP_TABLE2100  .long LBB23-JUMP_TABLE2101  .long LBB4-JUMP_TABLE2102  .long LBB23-JUMP_TABLE2103