1 # This script checks that YamlProfileReader in llvm-bolt is reading data
2 # correctly and stale data is corrected by profile inference.
4 RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
5 RUN: llvm-bolt %t.exe -o %t.null -b %p/Inputs/blarge_profile_stale.std-hash.yaml \
6 RUN: --print-cfg --print-only=usqrt,SolveCubic --infer-stale-profile=1 -v=1 \
7 RUN: 2>&1 | FileCheck %s
9 # Verify that yaml reader works as expected.
10 CHECK: pre-processing profile using YAML profile reader
11 CHECK: BOLT-INFO: YAML profile with hash: std::hash
13 # Function "SolveCubic" has stale profile, since there is one jump in the
14 # profile (from bid=13 to bid=2) which is not in the CFG in the binary. The test
15 # verifies that the inference is able to match two blocks (bid=1 and bid=13)
16 # using "loose" hashes and then correctly propagate the counts.
18 CHECK: Binary Function "SolveCubic" after building cfg {
19 CHECK: State : CFG constructed
20 CHECK: Address : 0x400e00
22 CHECK: Section : .text
25 CHECK: Exec Count : 151
26 CHECK: Branch Count: 552
28 # Verify block counts.
29 CHECK: .LBB00 (43 instructions, align : 1)
30 CHECK: Successors: .Ltmp[[#BB07:]] (mispreds: 0, count: 0), .LFT[[#BB01:]] (mispreds: 0, count: 151)
31 CHECK: .LFT[[#BB01:]] (5 instructions, align : 1)
32 CHECK: Successors: .Ltmp[[#BB013:]] (mispreds: 0, count: 151), .LFT[[#BB02:]] (mispreds: 0, count: 0)
33 CHECK: .Ltmp[[#BB03:]] (26 instructions, align : 1)
34 CHECK: Successors: .Ltmp[[#BB05:]] (mispreds: 0, count: 151), .LFT[[#BB04:]] (mispreds: 0, count: 0)
35 CHECK: .Ltmp[[#BB05:]] (9 instructions, align : 1)
36 CHECK: .Ltmp[[#BB013:]] (12 instructions, align : 1)
37 CHECK: Successors: .Ltmp[[#BB03:]] (mispreds: 0, count: 151)
38 CHECK: End of Function "SolveCubic"
40 # Function "usqrt" has stale profile, since the number of blocks in the profile
41 # (nblocks=6) does not match the size of the CFG in the binary. The entry
42 # block (bid=0) has an incorrect (missing) count, which should be inferred by
45 CHECK: Binary Function "usqrt" after building cfg {
46 CHECK: State : CFG constructed
47 CHECK: Address : 0x401170
49 CHECK: Section : .text
52 CHECK: Exec Count : 20
53 CHECK: Branch Count: 640
55 # Verify block counts.
56 CHECK: .LBB01 (4 instructions, align : 1)
57 CHECK: Successors: .Ltmp[[#BB113:]] (mispreds: 0, count: 20)
58 CHECK: .Ltmp[[#BB113:]] (9 instructions, align : 1)
59 CHECK: Successors: .Ltmp[[#BB112:]] (mispreds: 0, count: 320), .LFT[[#BB10:]] (mispreds: 0, count: 0)
60 CHECK: .LFT[[#BB10:]] (2 instructions, align : 1)
61 CHECK: Successors: .Ltmp[[#BB112:]] (mispreds: 0, count: 0)
62 CHECK: .Ltmp[[#BB112:]] (2 instructions, align : 1)
63 CHECK: Successors: .Ltmp[[#BB113:]] (mispreds: 0, count: 300), .LFT[[#BB11:]] (mispreds: 0, count: 20)
64 CHECK: .LFT[[#BB11:]] (2 instructions, align : 1)
65 CHECK: End of Function "usqrt"
66 # Check the overall inference stats.
67 CHECK: 2 out of 7 functions in the binary (28.6%) have non-empty execution profile
68 CHECK: inferred profile for 2 (100.00% of profiled, 100.00% of stale) functions responsible for {{.*}} samples ({{.*}} out of {{.*}})