108 lines · plain
1## Check new BAT format containing hashes for YAML profile.2 3RUN: yaml2obj %p/Inputs/blarge_new.yaml &> %t.exe4RUN: llvm-bolt %t.exe -o %t.out --pa -p %p/Inputs/blarge_new.preagg.txt \5RUN: --reorder-blocks=ext-tsp --split-functions --split-strategy=cdsplit \6RUN: --reorder-functions=cdsort --enable-bat --dyno-stats --skip-funcs=main \7RUN: 2>&1 | FileCheck --check-prefix WRITE-BAT-CHECK %s8## Check that branch with entry in BAT is accounted for.9RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat_branchentry.preagg.txt \10RUN: -w %t.yaml -o %t.fdata11RUN: llvm-bolt %t.exe -data %t.fdata -w %t.yaml-fdata -o %t.null12RUN: FileCheck --input-file %t.yaml --check-prefix BRANCHENTRY-YAML-CHECK %s13RUN: FileCheck --input-file %t.yaml-fdata --check-prefix BRANCHENTRY-YAML-CHECK %s14BRANCHENTRY-YAML-CHECK: - name: SolveCubic15BRANCHENTRY-YAML-CHECK: bid: 016BRANCHENTRY-YAML-CHECK: hash: 0x700F19D2460000017BRANCHENTRY-YAML-CHECK-NEXT: succ: [ { bid: 7, cnt: 1 }18## Check that the order is correct between BAT YAML and FDATA->YAML.19RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat_order.preagg.txt \20RUN: -w %t.yaml -o %t.fdata21RUN: llvm-bolt %t.exe -data %t.fdata -w %t.yaml-fdata -o %t.null22RUN: FileCheck --input-file %t.yaml --check-prefix ORDER-YAML-CHECK %s23RUN: FileCheck --input-file %t.yaml-fdata --check-prefix ORDER-YAML-CHECK %s24ORDER-YAML-CHECK: - name: SolveCubic25ORDER-YAML-CHECK: bid: 326ORDER-YAML-CHECK: hash: 0xDDA1DC5F69F900AC27ORDER-YAML-CHECK-NEXT: calls: [ { off: 0x26, fid: [[#]], cnt: 20 } ]28ORDER-YAML-CHECK-NEXT: succ: [ { bid: 5, cnt: 7 }29## Large profile test30RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat.preagg.txt -w %t.yaml -o %t.fdata \31RUN: --heatmap %t.hm 2>&1 | FileCheck --check-prefix READ-BAT-CHECK %s32RUN: FileCheck --input-file %t.yaml --check-prefix YAML-BAT-CHECK %s33RUN: FileCheck --input-file %t.hm-section-hotness.csv --check-prefix CHECK-HM %s34## Check that YAML converted from fdata matches YAML created directly with BAT.35RUN: llvm-bolt %t.exe -data %t.fdata -w %t.yaml-fdata -o /dev/null \36RUN: 2>&1 | FileCheck --check-prefix READ-BAT-FDATA-CHECK %s37RUN: FileCheck --input-file %t.yaml-fdata --check-prefix YAML-BAT-CHECK %s38 39## Test resulting YAML profile with the original binary (no-stale mode)40RUN: llvm-bolt %t.exe -data %t.yaml -o %t.null -dyno-stats 2>&1 \41RUN: | FileCheck --check-prefix CHECK-BOLT-YAML %s42 43WRITE-BAT-CHECK: BOLT-INFO: Wrote 5 BAT maps44WRITE-BAT-CHECK: BOLT-INFO: Wrote 4 function and 22 basic block hashes45WRITE-BAT-CHECK: BOLT-INFO: BAT section size (bytes): 40446 47READ-BAT-CHECK-NOT: BOLT-ERROR: unable to save profile in YAML format for input file processed by BOLT48READ-BAT-CHECK: BOLT-INFO: Parsed 5 BAT entries49READ-BAT-CHECK: PERF2BOLT: read 79 aggregated brstack entries50READ-BAT-CHECK: HEATMAP: building heat map51READ-BAT-CHECK: BOLT-INFO: 5 out of 21 functions in the binary (23.8%) have non-empty execution profile52READ-BAT-FDATA-CHECK: BOLT-INFO: 5 out of 16 functions in the binary (31.2%) have non-empty execution profile53CHECK-HM: .text, 0x800000, 0x8002cc, 38.7595, 91.6667, 0.355354 55YAML-BAT-CHECK: functions:56# Function not covered by BAT - has insns in basic block57YAML-BAT-CHECK: - name: main58YAML-BAT-CHECK-NEXT: fid: 259YAML-BAT-CHECK-NEXT: hash: 0x9895746D48B2C87660YAML-BAT-CHECK-NEXT: exec: 061YAML-BAT-CHECK-NEXT: nblocks: 4662YAML-BAT-CHECK-NEXT: blocks:63YAML-BAT-CHECK-NEXT: - bid: 064YAML-BAT-CHECK-NEXT: insns: 2665YAML-BAT-CHECK-NEXT: hash: 0xA900AE79CFD4000066YAML-BAT-CHECK-NEXT: succ: [ { bid: 3, cnt: 0 }, { bid: 1, cnt: 0 } ]67# Check fallthroughs in non-BAT function68YAML-BAT-CHECK-NEXT: - bid: 2769YAML-BAT-CHECK-NEXT: insns: 370YAML-BAT-CHECK-NEXT: hash: 0x30A1EBA77A903F071YAML-BAT-CHECK-NEXT: succ: [ { bid: 28, cnt: 1 } ]72# Calls from no-BAT to BAT function73YAML-BAT-CHECK: - bid: 2874YAML-BAT-CHECK-NEXT: insns: 1375YAML-BAT-CHECK-NEXT: hash: 0xB2F04C1F25F0040076YAML-BAT-CHECK-NEXT: calls: [ { off: 0x21, fid: [[#SOLVECUBIC:]], cnt: 25 }, { off: 0x2D, fid: [[#]], cnt: 9 } ]77# Function covered by BAT with calls78YAML-BAT-CHECK: - name: SolveCubic79YAML-BAT-CHECK-NEXT: fid: [[#SOLVECUBIC]]80YAML-BAT-CHECK-NEXT: hash: 0x6AF7E61EA396672281YAML-BAT-CHECK-NEXT: exec: 2582YAML-BAT-CHECK-NEXT: nblocks: 1583YAML-BAT-CHECK-NEXT: blocks:84YAML-BAT-CHECK-NEXT: - bid: 085YAML-BAT-CHECK-NEXT: insns: [[#]]86YAML-BAT-CHECK-NEXT: hash: 0x700F19D2460000087YAML-BAT-CHECK-NEXT: exec: 2588YAML-BAT-CHECK: - bid: 389YAML-BAT-CHECK-NEXT: insns: [[#]]90YAML-BAT-CHECK-NEXT: hash: 0xDDA1DC5F69F900AC91YAML-BAT-CHECK-NEXT: calls: [ { off: 0x26, fid: [[#]], cnt: [[#]] } ]92YAML-BAT-CHECK-NEXT: succ: [ { bid: 5, cnt: [[#]] }93# Function covered by BAT - doesn't have insns in basic block94YAML-BAT-CHECK: - name: usqrt95YAML-BAT-CHECK-NEXT: fid: [[#]]96YAML-BAT-CHECK-NEXT: hash: 0x99E67ED32A20302397YAML-BAT-CHECK-NEXT: exec: 2198YAML-BAT-CHECK-NEXT: nblocks: 599YAML-BAT-CHECK-NEXT: blocks:100YAML-BAT-CHECK: - bid: 1101YAML-BAT-CHECK-NEXT: insns: [[#]]102YAML-BAT-CHECK-NEXT: hash: 0xD70DC695320E0010103YAML-BAT-CHECK-NEXT: succ: {{.*}} { bid: 2, cnt: [[#]]104 105CHECK-BOLT-YAML: pre-processing profile using YAML profile reader106CHECK-BOLT-YAML-NEXT: 5 out of 16 functions in the binary (31.2%) have non-empty execution profile107CHECK-BOLT-YAML-NOT: invalid (possibly stale) profile108