xref: /llvm-project/bolt/test/runtime/X86/reg-reassign-no-swap-bl.s (revision 83f5497155e1d37c9b08447a2225a789095d53b0)
1# This test case is used to reproduce an issue found in the mongod database.
2# In function rankRegisters, if there is a BH Reg in the basic block, then the BL Reg
3# also cannot be swap.
4
5# REQUIRES: system-linux
6
7# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
8# RUN: link_fdata %s %t.o %t.fdata
9# RUN: llvm-strip --strip-unneeded %t.o
10# RUN: %clang -no-pie %t.o -o %t.exe -Wl,-q
11# RUN: llvm-bolt %t.exe -o %t.out -data=%t.fdata --reg-reassign | FileCheck %s
12# RUN: %t.out
13
14# CHECK: Reg Reassignment Pass: no changes were made
15  .text
16  .globl  main
17  .globl  main.cold
18  .p2align  4, 0x90
19  .type  main,@function
20  .type  main.cold,@function
21main.cold:
22bb1:
23  mov    $0x2,  %bh
24bb2:
25  jmp    bb5
26main:                                   # @main
27  .cfi_startproc
28# %bb.0:                                # %entry
29  pushq  %rax
30  pushq   %r12
31  pushq   %rbx
32  .cfi_def_cfa_offset 16
33  mov     $0x1,   %r12
34  shr     $0x14,  %r12
35  add     $0x14,  %r12
36  mov     $0x11,  %rbx
37  mov    $0x1,  %bh
38  mov    $0x1,  %bl
39bb3:
40  add    $0x1,   %r12
41bb4:
42  jmp    bb1
43bb5:
44  cmp     $0x201,  %rbx
45  jne     0x0
46bb6:
47  xorl    %eax, %eax
48  popq    %rcx
49  popq    %rbx
50  popq    %r12
51  .cfi_def_cfa_offset 8
52  retq
53# FDATA: 1 main.cold #bb2# 1 main 0 0 100
54# FDATA: 1 main #bb3# 1 main #bb4# 0 100
55# FDATA: 1 main #bb4# 1 main.cold 0 0 100
56
57.Lfunc_end0:
58  .size  main, .Lfunc_end0-main
59  .cfi_endproc
60