93 lines · plain
1## Check that llvm-bolt successfully relaxes branches for compact (<128MB) code2## model.3 4# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o5# RUN: link_fdata %s %t.o %t.fdata6# RUN: llvm-strip --strip-unneeded %t.o7# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static8# RUN: llvm-bolt %t.exe -o %t.bolt --data %t.fdata --split-functions \9# RUN: --keep-nops --compact-code-model10# RUN: llvm-objdump -d \11# RUN: --disassemble-symbols=_start,_start.cold.0,foo,foo.cold.0 %t.bolt \12# RUN: | FileCheck %s13# RUN: llvm-nm -nS %t.bolt | FileCheck %s --check-prefix=CHECK-NM14 15## Fragments of _start and foo will be separated by large_function which is over16## 1MB in size - larger than all conditional branches can cover requiring branch17## relaxation.18 19# CHECK-NM: _start20# CHECK-NM: foo21# CHECK-NM: 0000000000124f84 T large_function22# CHECK-NM: _start.cold.023# CHECK-NM: foo.cold.024 25 .text26 .globl _start27 .type _start, %function28_start:29# CHECK: <_start>:30# FDATA: 0 [unknown] 0 1 _start 0 0 10031 .cfi_startproc32 cmp x0, 133 b.eq .L034# CHECK: b.eq35# CHECK-NEXT: b36# CHECK-NEXT: b37 38 bl large_function39.L0:40 ret x3041 .cfi_endproc42.size _start, .-_start43 44## Check that long branch in foo() is reused during relaxation. I.e. we should45## see just one branch to the cold fragment.46 47 .globl foo48 .type foo, %function49foo:50# CHECK: <foo>:51# FDATA: 0 [unknown] 0 1 foo 0 0 10052 .cfi_startproc53 cmp x0, 054.T0:55 b.eq .ERROR56# CHECK: b {{.*}} <foo.cold.0>57# CHECK-NOT: b {{.*}} <foo.cold.0>58# FDATA: 1 foo #.T0# 1 foo #.T1# 0 10059.T1:60 bl large_function61 cmp x0, 162.T2:63 b.eq .ERROR64# FDATA: 1 foo #.T2# 1 foo #.T3# 0 10065.T3:66 mov x1, x067 mov x0, 068 ret x3069 70# CHECK: <foo.cold.0>:71# CHECK-NEXT: mov x0, #0x172# CHECK-NEXT: ret73.ERROR:74 mov x0, 175 ret x3076 .cfi_endproc77.size foo, .-foo78 79 .globl large_function80 .type large_function, %function81large_function:82# FDATA: 0 [unknown] 0 1 large_function 0 0 10083 .cfi_startproc84 .rept 30000085 nop86 .endr87 ret x3088 .cfi_endproc89.size large_function, .-large_function90 91## Force relocation mode.92 .reloc 0, R_AARCH64_NONE93