Skip to content

Commit fa064f4

Browse files
dhoekwatercopybara-github
authored andcommitted
Add testdata for a function with a nested loop
PiperOrigin-RevId: 696656396
1 parent cd89d70 commit fa064f4

5 files changed

+367
-0
lines changed

propeller/testdata/BUILD

+4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ exports_files([
3535
"bimodal_sample.x.bin",
3636
"call_from_simple_loop.protobuf",
3737
"clang_v0_labels.binary",
38+
"hot_and_cold_landing_pads.protobuf",
3839
"llvm_function_samples.binary",
3940
"llvm_function_samples_perf.data",
41+
"loop_no_entry_no_exit.protobuf",
42+
"multiple_cold_blocks.protobuf",
43+
"nested_loop.protobuf",
4044
"propeller_sample.protobuf",
4145
"propeller_sample_1.bin",
4246
"sample.bin",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
## CFG Proto for two functions: Function foo has two exception handling landing
2+
## pads. One is cold, the other is hot.
3+
##
4+
##
5+
## 10
6+
## +-----------------+
7+
## | |
8+
## v 20 |
9+
## foo -------------> bar
10+
## / \
11+
## 10 / \ 10
12+
## v v
13+
## foo.1 foo.2 ----+
14+
## / \ |
15+
## 10 / \ 0 |
16+
## v v |
17+
## foo.4 foo.3 [eh pad] |
18+
## \ / | 10
19+
## 10 \ /0 |
20+
## \ / |
21+
## v v |
22+
## foo.5 <--------------+
23+
##
24+
25+
cfg {
26+
name: "foo"
27+
function_index: 10
28+
node {
29+
bb_id: 0
30+
size: 10
31+
out_edges {
32+
sink: {
33+
function_index: 10
34+
bb_index: 1
35+
}
36+
weight: 10
37+
kind: BRANCH_OR_FALLTHROUGH
38+
}
39+
out_edges {
40+
sink: {
41+
function_index: 10
42+
bb_index: 2
43+
}
44+
weight: 10
45+
kind: BRANCH_OR_FALLTHROUGH
46+
}
47+
out_edges {
48+
sink: {
49+
function_index: 20
50+
bb_index: 0
51+
}
52+
weight: 20
53+
kind: CALL
54+
}
55+
}
56+
node {
57+
bb_id: 1
58+
size: 10
59+
out_edges {
60+
sink: {
61+
function_index: 10
62+
bb_index: 4
63+
}
64+
weight: 10
65+
kind: BRANCH_OR_FALLTHROUGH
66+
}
67+
out_edges {
68+
sink: {
69+
function_index: 10
70+
bb_index: 3
71+
}
72+
weight: 0
73+
kind: BRANCH_OR_FALLTHROUGH
74+
}
75+
}
76+
node {
77+
bb_id: 2
78+
size: 10
79+
metadata {
80+
is_landing_pad : true
81+
}
82+
out_edges {
83+
sink: {
84+
function_index: 10
85+
bb_index: 5
86+
}
87+
weight: 10
88+
kind: BRANCH_OR_FALLTHROUGH
89+
}
90+
}
91+
node {
92+
bb_id: 3
93+
size: 10
94+
metadata {
95+
is_landing_pad: true
96+
}
97+
out_edges {
98+
sink: {
99+
function_index: 10
100+
bb_index: 5
101+
}
102+
weight: 0
103+
kind: BRANCH_OR_FALLTHROUGH
104+
}
105+
}
106+
node {
107+
bb_id: 4
108+
size: 10
109+
out_edges {
110+
sink: {
111+
function_index: 10
112+
bb_index: 5
113+
}
114+
weight: 10
115+
kind: BRANCH_OR_FALLTHROUGH
116+
}
117+
}
118+
node {
119+
bb_id: 5
120+
size: 10
121+
}
122+
}
123+
124+
cfg {
125+
name: "bar"
126+
function_index: 20
127+
node {
128+
bb_id: 0
129+
size: 10
130+
out_edges {
131+
sink: {
132+
function_index: 10
133+
bb_index: 0
134+
}
135+
weight: 10
136+
kind: RETURN
137+
}
138+
}
139+
}
140+
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+
}

0 commit comments

Comments
 (0)