1## Tests blocks matching by called function names in inferStaleProfile. 2 3# REQUIRES: system-linux 4# RUN: split-file %s %t 5# RUN: %clangxx %cxxflags %t/main.cpp -o %t.exe -Wl,-q -nostdlib 6# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml --profile-ignore-hash -v=1 \ 7# RUN: --dyno-stats --print-cfg --infer-stale-profile=1 --match-with-call-graph 2>&1 | FileCheck %s 8 9# CHECK: BOLT-INFO: matched 1 functions with call graph 10 11#--- main.cpp 12void foo() {} 13 14void bar() {} 15 16void qux() { 17 foo(); 18 bar(); 19} 20 21void fred() { 22 foo(); 23 qux(); 24 bar(); 25 bar(); 26 foo(); 27} 28 29int main() { 30 return 0; 31} 32 33#--- yaml 34--- 35header: 36 profile-version: 1 37 binary-name: 'match-functions-with-calls-as-anchors.s.tmp.exe' 38 binary-build-id: '<unknown>' 39 profile-flags: [ lbr ] 40 profile-origin: branch profile reader 41 profile-events: '' 42 dfs-order: false 43 hash-func: xxh3 44functions: 45 - name: main 46 fid: 0 47 hash: 0x0000000000000001 48 exec: 1 49 nblocks: 6 50 blocks: 51 - bid: 1 52 hash: 0x0000000000000001 53 insns: 1 54 succ: [ { bid: 3, cnt: 1} ] 55 - name: _Z3foov 56 fid: 1 57 hash: 0x0000000000000002 58 exec: 1 59 nblocks: 6 60 blocks: 61 - bid: 1 62 hash: 0x0000000000000002 63 insns: 1 64 succ: [ { bid: 3, cnt: 1} ] 65 66 - name: _Z3barv 67 fid: 2 68 hash: 0x0000000000000003 69 exec: 1 70 nblocks: 6 71 blocks: 72 - bid: 1 73 hash: 0x0000000000000003 74 insns: 1 75 succ: [ { bid: 3, cnt: 1} ] 76 - name: _Z3quxv 77 fid: 3 78 hash: 0x0000000000000004 79 exec: 4 80 nblocks: 6 81 blocks: 82 - bid: 1 83 hash: 0x0000000000000004 84 insns: 1 85 succ: [ { bid: 3, cnt: 1} ] 86 calls: [ { off : 0, fid : 1, cnt : 0}, 87 { off : 0, fid : 2, cnt : 0} ] 88 - name: _Z4bazv 89 fid: 4 90 hash: 0x0000000000000005 91 exec: 1 92 nblocks: 6 93 blocks: 94 - bid: 1 95 hash: 0x0000000000000005 96 insns: 1 97 succ: [ { bid: 3, cnt: 1} ] 98 calls: [ { off : 0, fid : 3, cnt : 0}, 99 { off : 0, fid : 1, cnt : 0}, 100 { off : 0, fid : 2, cnt : 0}, 101 { off : 0, fid : 1, cnt : 0}, 102 { off : 0, fid : 2, cnt : 0} ] 103... 104