brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 3d3247f Raw
82 lines · plain
1## This reproduces an issue where two fragments of same function access same2## jump table, which means at least one fragment visits the other, i.e., one3## of them has split jump table. As a result, all of them will be marked as4## non-simple function.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 -print-cfg -v=3 %t.exe -o %t.out 2>&1 | FileCheck %s12 13# CHECK: BOLT-INFO: multiple fragments access the same jump table: main; main.cold.114# CHECK: PIC Jump table JUMP_TABLE1 for function main, main.cold.1 at {{.*}}  with a total count of 0:15 16  .text17  .globl main18  .type main, %function19  .p2align 220main:21LBB0:22  andl $0xf, %ecx23  cmpb $0x4, %cl24  ## exit through ret25  ja LBB326 27## jump table dispatch, jumping to label indexed by val in %ecx28LBB1:29  leaq JUMP_TABLE1(%rip), %r830  movzbl %cl, %ecx31  movslq (%r8,%rcx,4), %rax32  addq %rax, %r833  jmpq *%r834 35LBB2:36  xorq %rax, %rax37LBB3:38  addq $0x8, %rsp39  ret40.size main, .-main41 42## cold fragment is only reachable43  .globl main.cold.144  .type main.cold.1, %function45  .p2align 246main.cold.1:47  ## load bearing nop: pad LBB8 so that it can't be treated48  ## as __builtin_unreachable by analyzeJumpTable49  nop50LBB4:51  andl $0xb, %ebx52  cmpb $0x1, %cl53  # exit through ret54  ja LBB755 56## jump table dispatch, jumping to label indexed by val in %ecx57LBB5:58  leaq JUMP_TABLE1(%rip), %r859  movzbl %cl, %ecx60  movslq (%r8,%rcx,4), %rax61  addq %rax, %r862  jmpq *%r863 64LBB6:65  xorq %rax, %rax66LBB7:67  addq $0x8, %rsp68  ret69LBB8:70  callq abort71.size main.cold.1, .-main.cold.172 73  .rodata74## jmp table, entries must be R_X86_64_PC32 relocs75  .globl JUMP_TABLE176JUMP_TABLE1:77  .long LBB2-JUMP_TABLE178  .long LBB3-JUMP_TABLE179  .long LBB8-JUMP_TABLE180  .long LBB6-JUMP_TABLE181  .long LBB7-JUMP_TABLE182