xref: /llvm-project/bolt/test/X86/split-random.s (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1## Test random function splitting option
2
3# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
4# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
5# RUN: llvm-bolt %t.exe -o %t.random2 --split-functions \
6# RUN:         --split-strategy=random2 --print-finalized \
7# RUN:         --print-only=two_block --bolt-seed=7 2>&1 | \
8# RUN:     FileCheck %s
9# RUN: llvm-bolt %t.exe -o %t.randomN --split-functions \
10# RUN:         --split-strategy=randomN --print-finalized \
11# RUN:         --print-only=two_block --bolt-seed=7 2>&1 | \
12# RUN:     FileCheck %s
13
14# CHECK: Binary Function "two_block"
15# CHECK:   IsSplit     :
16# CHECK-SAME: {{ 1$}}
17
18        .text
19        .globl  single_block
20        .type   single_block, @function
21single_block:
22        ret
23        .size   single_block, .-single_block
24
25
26        .globl  two_block
27        .type   two_block, @function
28two_block:
29.L3:
30        subl    $1, %edi
31        testl   %edi, %edi
32        jg      .L3
33        jmp     .L4
34.L4:
35        subl    $1, %edi
36        subl    $1, %edi
37        subl    $1, %edi
38        subl    $1, %edi
39        ret
40        .size   two_block, .-two_block
41
42
43        .globl  main
44        .type   main, @function
45main:
46        call    single_block
47        movl    $10, %edi
48        call    two_block
49        ret
50        .size   main, .-main
51