xref: /llvm-project/bolt/test/X86/profile-passthrough-block.test (revision b06f97b039b3a4f2397281609069b2aaad86dd59)
1## Test YAMLProfileReader support for pass-through blocks in non-matching edges:
2## match the profile edge A -> C to the CFG with blocks A -> B -> C.
3
4# REQUIRES: system-linux
5# RUN: split-file %s %t
6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
7# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
8# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml --profile-ignore-hash -v=1 \
9# RUN:   --print-cfg 2>&1 | FileCheck %s
10
11# CHECK: Binary Function "main" after building cfg
12# CHECK: Profile Acc : 100.0%
13# CHECK-NOT: BOLT-WARNING: no successor for block .LFT0 that matches index 3 or block .Ltmp0
14
15#--- main.s
16.globl main
17.type	main, @function
18main:
19  .cfi_startproc
20.LBB00:
21  pushq   %rbp
22  movq    %rsp, %rbp
23  subq    $16, %rsp
24  testq   %rax, %rax
25  js      .LBB03
26.LBB01:
27  jne     .LBB04
28.LBB02:
29  nop
30.LBB03:
31  xorl    %eax, %eax
32  addq    $16, %rsp
33  popq    %rbp
34  retq
35.LBB04:
36  xorl    %eax, %eax
37  addq    $16, %rsp
38  popq    %rbp
39  retq
40## For relocations against .text
41.LBB05:
42  call exit
43  .cfi_endproc
44  .size	main, .-main
45
46#--- yaml
47---
48header:
49  profile-version: 1
50  binary-name:     'profile-passthrough-block.s.tmp.exe'
51  binary-build-id: '<unknown>'
52  profile-flags:   [ lbr ]
53  profile-origin:  branch profile reader
54  profile-events:  ''
55  dfs-order:       false
56  hash-func:       xxh3
57functions:
58  - name:            main
59    fid:             0
60    hash:            0x0000000000000000
61    exec:            1
62    nblocks:         6
63    blocks:
64      - bid:             1
65        insns:           1
66        succ:            [ { bid: 3, cnt: 1} ]
67...
68