164 lines · plain
1## Tests blocks matching by called function names in inferStaleProfile.2 3# REQUIRES: system-linux, asserts4# RUN: split-file %s %t5# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o6# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib7# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml --profile-ignore-hash -v=1 \8# RUN: --dyno-stats --print-cfg --infer-stale-profile=1 --debug-only=bolt-prof \9# RUN: 2>&1 | FileCheck %s10 11# CHECK: BOLT-INFO: applying profile inference for "qux"12# CHECK: Matched yaml block (bid = 1) with hash 4 to BB (index = 0) with hash 314e1bc1000013# CHECK: call match14 15# CHECK: BOLT-INFO: applying profile inference for "fred"16# CHECK: Matched yaml block (bid = 1) with hash 5 to BB (index = 0) with hash 7541bc1000017# CHECK: call match18 19#--- main.s20.globl foo # -- Begin function foo21 .p2align 4, 0x9022 .type foo,@function23foo: # @foo24# %bb.0:25 pushq %rbp26 movq %rsp, %rbp27 popq %rbp28 retq29.Lfunc_end0:30 .size foo, .Lfunc_end0-foo31 # -- End function32 .globl bar # -- Begin function bar33 .p2align 4, 0x9034 .type bar,@function35bar: # @bar36# %bb.0:37 pushq %rbp38 movq %rsp, %rbp39 popq %rbp40 retq41.Lfunc_end1:42 .size bar, .Lfunc_end1-bar43 # -- End function44 .globl qux # -- Begin function qux45 .p2align 4, 0x9046 .type qux,@function47qux: # @qux48# %bb.0:49 pushq %rbp50 movq %rsp, %rbp51 callq foo52 callq bar53 popq %rbp54 retq55.Lfunc_end2:56 .size qux, .Lfunc_end2-qux57 # -- End function58 .globl fred # -- Begin function fred59 .p2align 4, 0x9060 .type fred,@function61fred: # @fred62# %bb.0:63 pushq %rbp64 movq %rsp, %rbp65 callq foo66 callq qux67 callq bar68 callq bar69 callq foo70 popq %rbp71 retq72.Lfunc_end3:73 .size fred, .Lfunc_end3-fred74 # -- End function75 .globl main # -- Begin function main76 .p2align 4, 0x9077 .type main,@function78main: # @main79# %bb.0:80 pushq %rbp81 movq %rsp, %rbp82 xorl %eax, %eax83 popq %rbp84 retq85.Lfunc_end4:86 .size main, .Lfunc_end4-main87 # -- End function88 .addrsig89 .addrsig_sym foo90 .addrsig_sym bar91 .addrsig_sym qux92 93#--- yaml94---95header:96 profile-version: 197 binary-name: 'match-functions-with-calls-as-anchors.s.tmp.exe'98 binary-build-id: '<unknown>'99 profile-flags: [ lbr ]100 profile-origin: branch profile reader101 profile-events: ''102 dfs-order: false103 hash-func: xxh3104functions:105 - name: main106 fid: 0107 hash: 0x0000000000000001108 exec: 1109 nblocks: 6110 blocks:111 - bid: 1112 hash: 0x0000000000000001113 insns: 1114 succ: [ { bid: 3, cnt: 1} ]115 - name: foo116 fid: 1117 hash: 0x0000000000000002118 exec: 1119 nblocks: 6120 blocks:121 - bid: 1122 hash: 0x0000000000000002123 insns: 1124 succ: [ { bid: 3, cnt: 1} ]125 126 - name: bar127 fid: 2128 hash: 0x0000000000000003129 exec: 1130 nblocks: 6131 blocks:132 - bid: 1133 hash: 0x0000000000000003134 insns: 1135 succ: [ { bid: 3, cnt: 1} ]136 - name: qux137 fid: 3138 hash: 0x0000000000000004139 exec: 4140 nblocks: 6141 blocks:142 - bid: 1143 hash: 0x0000000000000004144 insns: 1145 succ: [ { bid: 3, cnt: 1} ]146 calls: [ { off : 0, fid : 1, cnt : 0},147 { off : 0, fid : 2, cnt : 0} ]148 - name: fred149 fid: 4150 hash: 0x0000000000000005151 exec: 1152 nblocks: 6153 blocks:154 - bid: 1155 hash: 0x0000000000000005156 insns: 1157 succ: [ { bid: 3, cnt: 1} ]158 calls: [ { off : 0, fid : 3, cnt : 0},159 { off : 0, fid : 1, cnt : 0},160 { off : 0, fid : 2, cnt : 0},161 { off : 0, fid : 1, cnt : 0},162 { off : 0, fid : 2, cnt : 0} ]163...164