70 lines · plain
1# UNSUPPORTED: true2## This script checks that YamlProfileReader in llvm-bolt is reading data3## correctly and stale data is corrected by profile inference.4 5RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe6RUN: llvm-bolt %t.exe -o %t.null -b %p/Inputs/blarge_profile_stale.std-hash.yaml \7RUN: --print-cfg --print-only=usqrt,SolveCubic --infer-stale-profile=1 -v=1 \8RUN: 2>&1 | FileCheck %s9 10## Verify that yaml reader works as expected.11CHECK: pre-processing profile using YAML profile reader12CHECK: BOLT-INFO: YAML profile with hash: std::hash13 14## Function "SolveCubic" has stale profile, since there is one jump in the15## profile (from bid=13 to bid=2) which is not in the CFG in the binary. The test16## verifies that the inference is able to match two blocks (bid=1 and bid=13)17## using "loose" hashes and then correctly propagate the counts.18 19CHECK: Binary Function "SolveCubic" after building cfg {20CHECK: State : CFG constructed21CHECK: Address : 0x400e0022CHECK: Size : 0x36823CHECK: Section : .text24CHECK: IsSimple : 125CHECK: BB Count : 1826CHECK: Exec Count : 15127CHECK: Sample Count: 55228CHECK: }29## Verify block counts.30CHECK: .LBB00 (43 instructions, align : 1)31CHECK: Successors: .Ltmp[[#BB07:]] (mispreds: 0, count: 0), .LFT[[#BB01:]] (mispreds: 0, count: 151)32CHECK: .LFT[[#BB01:]] (5 instructions, align : 1)33CHECK: Successors: .Ltmp[[#BB013:]] (mispreds: 0, count: 151), .LFT[[#BB02:]] (mispreds: 0, count: 0)34CHECK: .Ltmp[[#BB03:]] (26 instructions, align : 1)35CHECK: Successors: .Ltmp[[#BB05:]] (mispreds: 0, count: 151), .LFT[[#BB04:]] (mispreds: 0, count: 0)36CHECK: .Ltmp[[#BB05:]] (9 instructions, align : 1)37CHECK: .Ltmp[[#BB013:]] (12 instructions, align : 1)38CHECK: Successors: .Ltmp[[#BB03:]] (mispreds: 0, count: 151)39CHECK: End of Function "SolveCubic"40 41## Function "usqrt" has stale profile, since the number of blocks in the profile42## (nblocks=6) does not match the size of the CFG in the binary. The entry43## block (bid=0) has an incorrect (missing) count, which should be inferred by44# #the algorithm.45 46CHECK: Binary Function "usqrt" after building cfg {47CHECK: State : CFG constructed48CHECK: Address : 0x40117049CHECK: Size : 0x4350CHECK: Section : .text51CHECK: IsSimple : 152CHECK: BB Count : 553CHECK: Exec Count : 2054CHECK: Sample Count: 64055CHECK: }56## Verify block counts.57CHECK: .LBB01 (4 instructions, align : 1)58CHECK: Successors: .Ltmp[[#BB113:]] (mispreds: 0, count: 20)59CHECK: .Ltmp[[#BB113:]] (9 instructions, align : 1)60CHECK: Successors: .Ltmp[[#BB112:]] (mispreds: 0, count: 320), .LFT[[#BB10:]] (mispreds: 0, count: 0)61CHECK: .LFT[[#BB10:]] (2 instructions, align : 1)62CHECK: Successors: .Ltmp[[#BB112:]] (mispreds: 0, count: 0)63CHECK: .Ltmp[[#BB112:]] (2 instructions, align : 1)64CHECK: Successors: .Ltmp[[#BB113:]] (mispreds: 0, count: 300), .LFT[[#BB11:]] (mispreds: 0, count: 20)65CHECK: .LFT[[#BB11:]] (2 instructions, align : 1)66CHECK: End of Function "usqrt"67## Check the overall inference stats.68CHECK: 2 out of 7 functions in the binary (28.6%) have non-empty execution profile69CHECK: inferred profile for 2 (100.00% of profiled, 100.00% of stale) functions responsible for {{.*}} samples ({{.*}} out of {{.*}})70