xref: /llvm-project/bolt/test/X86/yaml-multiple-profiles.test (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1## This test ensures that a YAML profile with multiple profiles matching the same
2## function is handled gracefully.
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.null --data %t/profile.yaml \
9# RUN:   --profile-ignore-hash -v=1 2>&1 | FileCheck %s
10# CHECK: BOLT-WARNING: dropping duplicate profile for main_alias(*2)
11#--- main.s
12  .globl main_alias
13  .type main_alias, %function
14main_alias:
15  .globl main
16  .type main, %function
17main:
18  .cfi_startproc
19  cmpl	$0x0, %eax
20  retq
21  .cfi_endproc
22.size main, .-main
23.size main_alias, .-main_alias
24#--- profile.yaml
25---
26header:
27  profile-version: 1
28  binary-name:     'yaml-multiple-profiles.test.tmp.exe'
29  binary-build-id: '<unknown>'
30  profile-flags:   [ lbr ]
31  profile-origin:  branch profile reader
32  profile-events:  ''
33  dfs-order:       false
34functions:
35  - name:            'main(*2)'
36    fid:             1
37    hash:            0x50BBA3441D436491
38    exec:            1
39    nblocks:         1
40    blocks:
41      - bid:             0
42        insns:           2
43        hash:            0x4D4D8FAF7D4C0000
44  - name:            'main_alias(*2)'
45    fid:             1
46    hash:            0x50BBA3441D436491
47    exec:            1
48    nblocks:         1
49    blocks:
50      - bid:             0
51        insns:           2
52        hash:            0x4D4D8FAF7D4C0000
53...
54