Skip to content

Commit 8c1af9c

Browse files
dhoekwatercopybara-github
authored andcommitted
Add testdata for a function that consists of two large basic blocks
PiperOrigin-RevId: 696656397
1 parent afd57b2 commit 8c1af9c

10 files changed

+835
-0
lines changed

propeller/testdata/BUILD

+9
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,23 @@ exports_files([
3838
"hot_and_cold_landing_pads.protobuf",
3939
"llvm_function_samples.binary",
4040
"llvm_function_samples_perf.data",
41+
"loop_no_entry_no_exit.protobuf",
42+
"multiple_cold_blocks.protobuf",
43+
"nested_loop.protobuf",
4144
"propeller_sample.protobuf",
4245
"propeller_sample_1.bin",
4346
"sample.bin",
4447
"sample.c",
4548
"sample_section.bin",
49+
"simple_conditionals_join.protobuf",
50+
"simple_loop.protobuf",
51+
"simple_multi_function.protobuf",
4652
"test_comdat.h",
4753
"test_comdat_1.cc",
4854
"test_comdat_2.cc",
55+
"three_branches.protobuf",
56+
"two_conditionals_in_loop.protobuf",
57+
"two_large_blocks.protobuf",
4958
])
5059

5160
# This rule generates a binary with comdat functions.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## CFG Proto for a function consisting of a simple loop with cold entry and exit
2+
## edges.
3+
##
4+
## foo
5+
## |
6+
## |0
7+
## V
8+
## a.BB.foo <--+
9+
## | |
10+
## | |45
11+
## |40 |
12+
## | |
13+
## v |
14+
## aa.BB.foo ---+
15+
## |
16+
## | 0
17+
## v
18+
## raa.BB.foo
19+
20+
cfg {
21+
name: "foo"
22+
function_index: 0
23+
node {
24+
bb_id: 0
25+
size: 10
26+
out_edges {
27+
sink: {
28+
function_index: 0
29+
bb_index: 1
30+
}
31+
weight: 0
32+
kind: BRANCH_OR_FALLTHROUGH
33+
}
34+
}
35+
node {
36+
bb_id: 1
37+
size: 6
38+
out_edges {
39+
sink: {
40+
function_index: 0
41+
bb_index: 2
42+
}
43+
weight: 40
44+
kind: BRANCH_OR_FALLTHROUGH
45+
}
46+
}
47+
node {
48+
bb_id: 2
49+
size: 4
50+
out_edges {
51+
sink: {
52+
function_index: 0
53+
bb_index: 3
54+
}
55+
weight: 0
56+
kind: BRANCH_OR_FALLTHROUGH
57+
}
58+
out_edges {
59+
sink: {
60+
function_index: 0
61+
bb_index: 1
62+
}
63+
weight: 45
64+
kind: BRANCH_OR_FALLTHROUGH
65+
}
66+
}
67+
node {
68+
bb_id: 3
69+
size: 3
70+
}
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## CFG Proto for a function consisting of three cold blocks and two hot blocks.
2+
##
3+
## foo
4+
##
5+
## foo.2 foo.4
6+
##
7+
## 40
8+
## foo.3 -----> foo.1
9+
10+
cfg {
11+
name: "foo"
12+
function_index: 999
13+
node {
14+
bb_id: 0
15+
size: 10
16+
}
17+
node {
18+
bb_id: 1
19+
size: 6
20+
}
21+
node {
22+
bb_id: 2
23+
size: 5
24+
}
25+
node {
26+
bb_id: 3
27+
size: 4
28+
out_edges {
29+
sink : {
30+
function_index: 999
31+
bb_index: 1
32+
}
33+
weight: 40
34+
kind: BRANCH_OR_FALLTHROUGH
35+
}
36+
}
37+
node {
38+
bb_id: 4
39+
size: 3
40+
}
41+
}
+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
## CFG Proto for a function consisting of a nested loop.
2+
## Ordinals are intentionally out-of-order.
3+
##
4+
## [1] foo
5+
## |
6+
## |5
7+
## V
8+
## [4] ara.BB.foo <-----+
9+
## | |
10+
## 60 | |
11+
## V |
12+
## [2] a.BB.foo <--+ |
13+
## | | |
14+
## 600 | 550 | | 40
15+
## V | |
16+
## [5] aara.BB.foo ---+ |
17+
## | |
18+
## 55 | |
19+
## V |
20+
## [6] aaara.BB.foo -------+
21+
## |
22+
## 10 |
23+
## V
24+
## [3] ra.BB.foo
25+
##
26+
cfg {
27+
name: "foo"
28+
function_index: 1
29+
node {
30+
bb_id: 0
31+
size: 10
32+
out_edges {
33+
sink: {
34+
function_index: 1
35+
bb_index: 3
36+
}
37+
weight: 5
38+
kind: BRANCH_OR_FALLTHROUGH
39+
}
40+
}
41+
node {
42+
bb_id: 1
43+
size: 10
44+
out_edges {
45+
sink: {
46+
function_index: 1
47+
bb_index: 4
48+
}
49+
weight: 600
50+
kind: BRANCH_OR_FALLTHROUGH
51+
}
52+
}
53+
node {
54+
bb_id: 2
55+
size: 10
56+
}
57+
node {
58+
bb_id: 3
59+
size: 10
60+
out_edges {
61+
sink: {
62+
function_index: 1
63+
bb_index: 1
64+
}
65+
weight: 60
66+
kind: BRANCH_OR_FALLTHROUGH
67+
}
68+
}
69+
70+
node {
71+
bb_id: 4
72+
size: 10
73+
out_edges {
74+
sink: {
75+
function_index: 1
76+
bb_index: 5
77+
}
78+
weight: 55
79+
kind: BRANCH_OR_FALLTHROUGH
80+
}
81+
out_edges {
82+
sink: {
83+
function_index: 1
84+
bb_index: 1
85+
}
86+
weight: 550
87+
kind: BRANCH_OR_FALLTHROUGH
88+
}
89+
}
90+
node {
91+
bb_id: 5
92+
size: 10
93+
out_edges {
94+
sink: {
95+
function_index: 1
96+
bb_index: 3
97+
}
98+
weight: 40
99+
kind: BRANCH_OR_FALLTHROUGH
100+
}
101+
out_edges {
102+
sink: {
103+
function_index: 1
104+
bb_index: 2
105+
}
106+
weight: 10
107+
kind: BRANCH_OR_FALLTHROUGH
108+
}
109+
}
110+
111+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
## CFG consisting of a function with two conditionals which eventually join on
2+
## a single return basic block. In addition, size of foo.2 is zero.
3+
##
4+
## foo
5+
## | \
6+
## | \110
7+
## | \
8+
## | v
9+
## 150| foo.1
10+
## | / \
11+
## | /100 \10
12+
## | / \
13+
## v v v
14+
## foo.2 foo.3
15+
## \ /
16+
## \ /
17+
## 250 \ /10
18+
## \ /
19+
## v v
20+
## foo.4
21+
22+
cfg {
23+
name: "foo"
24+
function_index: 10
25+
node {
26+
bb_id: 0
27+
size: 10
28+
out_edges {
29+
sink {
30+
function_index: 10
31+
bb_index: 1
32+
}
33+
weight: 110
34+
kind: BRANCH_OR_FALLTHROUGH
35+
}
36+
out_edges {
37+
sink {
38+
function_index: 10
39+
bb_index: 2
40+
}
41+
weight: 150
42+
kind: BRANCH_OR_FALLTHROUGH
43+
}
44+
}
45+
node {
46+
bb_id: 1
47+
size: 4
48+
out_edges {
49+
sink {
50+
function_index: 10
51+
bb_index: 2
52+
}
53+
weight: 100
54+
kind: BRANCH_OR_FALLTHROUGH
55+
}
56+
out_edges {
57+
sink {
58+
function_index: 10
59+
bb_index: 3
60+
}
61+
weight: 10
62+
kind: BRANCH_OR_FALLTHROUGH
63+
}
64+
}
65+
node {
66+
bb_id: 2
67+
size: 0
68+
out_edges {
69+
sink {
70+
function_index: 10
71+
bb_index: 4
72+
}
73+
weight: 250
74+
kind: BRANCH_OR_FALLTHROUGH
75+
}
76+
}
77+
node {
78+
bb_id: 3
79+
size: 2
80+
out_edges {
81+
sink {
82+
function_index: 10
83+
bb_index: 4
84+
}
85+
weight: 10
86+
kind: BRANCH_OR_FALLTHROUGH
87+
}
88+
}
89+
node {
90+
bb_id: 4
91+
size: 2
92+
}
93+
}

0 commit comments

Comments
 (0)