For test purposes, we want to split functions at a random split point to be able to test different layouts without relying on the profile. This patch introduces an option, that randomly chooses a split point to partition blocks of a function into hot and cold regions. Reviewed By: Amir, yota9 Differential Revision: https://reviews.llvm.org/D128773
46 lines
1.0 KiB
ArmAsm
46 lines
1.0 KiB
ArmAsm
# Test random function splitting option
|
|
|
|
# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
|
|
# RUN: %clang %cflags %t.o -o %t.exe
|
|
# RUN: llvm-bolt %t.exe -o %t.out --split-functions --split-random \
|
|
# RUN: --print-finalized --print-only=two_block --bolt-seed=7 2>&1 | \
|
|
# RUN: FileCheck %s
|
|
|
|
# CHECK: Binary Function "two_block"
|
|
# CHECK: IsSplit :
|
|
# CHECK-SAME: {{ 1$}}
|
|
|
|
.text
|
|
.globl single_block
|
|
.type single_block, @function
|
|
single_block:
|
|
ret
|
|
.size single_block, .-single_block
|
|
|
|
|
|
.globl two_block
|
|
.type two_block, @function
|
|
two_block:
|
|
.L3:
|
|
subl $1, %edi
|
|
testl %edi, %edi
|
|
jg .L3
|
|
jmp .L4
|
|
.L4:
|
|
subl $1, %edi
|
|
subl $1, %edi
|
|
subl $1, %edi
|
|
subl $1, %edi
|
|
ret
|
|
.size two_block, .-two_block
|
|
|
|
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
call single_block
|
|
movl $10, %edi
|
|
call two_block
|
|
ret
|
|
.size main, .-main
|