brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 115b5b0 Raw
65 lines · plain
1# This test case reproduces a bug where, during register swapping,2# the code fragments associated with the function need to be swapped3# together (which may be generated during PGO optimization). If not4# handled properly, optimized binary execution can result in a segmentation fault.5 6# REQUIRES: system-linux7 8# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o9# RUN: link_fdata %s %t.o %t.fdata10# RUN: llvm-strip --strip-unneeded %t.o11# RUN: %clang -no-pie %t.o -o %t.exe -Wl,-q12# RUN: llvm-bolt %t.exe -o %t.out -data=%t.fdata --reg-reassign | FileCheck %s13# RUN: %t.out14 15# CHECK: BOLT-INFO: Reg Reassignment Pass Stats16# CHECK-NEXT: 2 functions affected.17  .text18  .globl  main19  .globl  main.cold20  .p2align  4, 0x9021  .type   main,@function22  .type   main.cold,@function23main.cold:24bb1:25  cmp     $0x3, %r1226  jne     bb827bb2:28  jmp     bb429main:                                   # @main30  .cfi_startproc31# %bb.0:                                # %entry32  pushq   %rax33  pushq   %r1234  pushq   %rbx35  .cfi_def_cfa_offset 1636  mov     $0x1,  %r1237  mov     $0x2,  %rbx38  add     $0x1,  %r1239  shr     $0x14, %r1240  mov     $0x3,  %r1241bb3:42  jmp     bb143bb4:44  cmp     $0x3,  %r1245bb5:46  jne     bb847bb6:48  xorl    %eax, %eax49bb7:50  popq    %rcx51  popq    %rbx52  popq    %r1253  .cfi_def_cfa_offset 854  retq55bb8:56  mov  $0x1, %rax57  jmp  bb758# FDATA: 1 main.cold #bb2# 1 main #bb4# 0 10059# FDATA: 1 main #bb5# 1 main #bb6# 0 10060# FDATA: 1 main #bb3# 1 main.cold 0 0 10061 62.Lfunc_end0:63  .size  main, .Lfunc_end0-main64  .cfi_endproc65