xref: /llvm-project/bolt/test/X86/match-blocks-with-pseudo-probes.test (revision 9a9af0a23fc910694b6a806b7ce9cb2e7e4240ef)
1## Tests stale block matching with pseudo probes.
2
3# REQUIRES: system-linux
4# RUN: split-file %s %t
5# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
6# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
7# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml -v=2 \
8# RUN:   --print-cfg --funcs=main --infer-stale-profile \
9# RUN:   --stale-matching-with-pseudo-probes 2>&1 | FileCheck %s
10
11# CHECK: BOLT-INFO: inference found an exact pseudo probe match for 100.00% of basic blocks (1 out of 1 stale)
12
13#--- main.s
14 .text
15  .globl  main                            # -- Begin function main
16  .p2align        4, 0x90
17  .type   main,@function
18main:                                   # @main
19# %bb.0:
20  pushq   %rbp
21  movq    %rsp, %rbp
22  movl    $0, -4(%rbp)
23  .pseudoprobe    15822663052811949562 1 0 0 main
24  xorl    %eax, %eax
25  popq    %rbp
26  retq
27.Lfunc_end0:
28  .size   main, .Lfunc_end0-main
29                                  # -- End function
30  .section        .pseudo_probe_desc,"",@progbits
31  .quad   -2624081020897602054
32  .quad   4294967295
33  .byte   4
34  .ascii  "main"
35
36#--- yaml
37---
38header:
39  profile-version: 1
40  binary-name:     'match-blocks-with-pseudo-probes.s.tmp.exe'
41  binary-build-id: '<unknown>'
42  profile-flags:   [ lbr ]
43  profile-origin:  branch profile reader
44  profile-events:  ''
45  dfs-order:       false
46  hash-func:       xxh3
47functions:
48  - name:                   main
49    fid:                    0
50    hash:                   0x0000000000000001
51    exec:                   1
52    nblocks:                6
53    blocks:
54      - bid:             1
55        hash:            0xFFFFFFFFFFFFFFF1
56        insns:           1
57        succ:            [ { bid: 3, cnt: 1} ]
58        probes:          [ { blx: 1 } ]
59    inline_tree:         [ { g: 0 } ]
60pseudo_probe_desc:
61  gs:              [ 0xDB956436E78DD5FA ]
62  gh:              [ 0 ]
63  hs:              [ 0xFFFFFFFF ]
64