Skip to content

Commit 744bd2d

Browse files
dhoekwatercopybara-github
authored andcommitted
Add testdata for a file with multiple functions
PiperOrigin-RevId: 696656395
1 parent 6b42b73 commit 744bd2d

File tree

4 files changed

+346
-0
lines changed

4 files changed

+346
-0
lines changed

propeller/testdata/BUILD

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ exports_files([
4646
"sample.bin",
4747
"sample.c",
4848
"sample_section.bin",
49+
"simple_conditionals_join.protobuf",
50+
"simple_loop.protobuf",
51+
"simple_multi_function.protobuf",
4952
"test_comdat.h",
5053
"test_comdat_1.cc",
5154
"test_comdat_2.cc",
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+
}
+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
## CFG Proto for a function consisting of a conditional and a loop on one side
2+
## of the conditional.
3+
##
4+
## foo
5+
## |
6+
## |5
7+
## V
8+
## a.BB.foo <--+
9+
## / \ |
10+
## 0/ \95 |90
11+
## / \ |
12+
## v \ |
13+
## aa.BB.foo v |
14+
## \ aaa.BB.foo
15+
## \ /
16+
## \ /
17+
## 0\ /10
18+
## \ /
19+
## v v
20+
## raaa.BB.foo
21+
22+
cfg {
23+
name: "foo"
24+
name: "foo.alias"
25+
function_index: 0
26+
node {
27+
bb_id: 0
28+
size: 10
29+
out_edges {
30+
sink: {
31+
function_index: 0
32+
bb_index: 1
33+
}
34+
weight: 5
35+
kind: BRANCH_OR_FALLTHROUGH
36+
}
37+
}
38+
node {
39+
bb_id: 1
40+
size: 6
41+
out_edges {
42+
sink: {
43+
function_index: 0
44+
bb_index: 2
45+
}
46+
weight: 0
47+
kind: BRANCH_OR_FALLTHROUGH
48+
}
49+
out_edges {
50+
sink: {
51+
function_index: 0
52+
bb_index: 3
53+
}
54+
weight: 95
55+
kind: BRANCH_OR_FALLTHROUGH
56+
}
57+
}
58+
node {
59+
bb_id: 2
60+
size: 4
61+
out_edges {
62+
sink: {
63+
function_index: 0
64+
bb_index: 4
65+
}
66+
weight: 0
67+
kind: BRANCH_OR_FALLTHROUGH
68+
}
69+
}
70+
node {
71+
bb_id: 3
72+
size: 4
73+
out_edges {
74+
sink: {
75+
function_index: 0
76+
bb_index: 1
77+
}
78+
weight: 90
79+
kind: BRANCH_OR_FALLTHROUGH
80+
}
81+
out_edges {
82+
sink: {
83+
function_index: 0
84+
bb_index: 4
85+
}
86+
weight: 10
87+
kind: BRANCH_OR_FALLTHROUGH
88+
}
89+
}
90+
node {
91+
bb_id: 4
92+
size: 6
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
##
2+
## bar
3+
## / \
4+
## 100 / \ 0
5+
## / \
6+
## 100 (CALL) v v 0 CALL
7+
## foo <------------ bar.1 bar.2 -----> bar.5 baz qux -----+
8+
## / \ ^ ^ \ | ^ |
9+
## 20 / \80 80| | \100 | | 10 |
10+
## v v | | \ | 2 +-------+
11+
## foo.1 foo.2 --------+ | v v
12+
## | (RETURN) | bar.3 bar.4
13+
## | 20 (RETURN) |
14+
## +----------------------+
15+
16+
cfg {
17+
function_index: 0
18+
name: "foo"
19+
node {
20+
bb_id: 0
21+
size: 8
22+
out_edges {
23+
sink: {
24+
function_index: 0
25+
bb_index: 1
26+
}
27+
weight: 20
28+
kind: BRANCH_OR_FALLTHROUGH
29+
}
30+
out_edges {
31+
sink: {
32+
function_index: 0
33+
bb_index: 2
34+
}
35+
weight: 80
36+
kind: BRANCH_OR_FALLTHROUGH
37+
}
38+
}
39+
node {
40+
bb_id: 1
41+
size: 6
42+
out_edges {
43+
sink: {
44+
function_index: 1
45+
bb_index: 1
46+
}
47+
weight: 20
48+
kind: RETURN
49+
}
50+
}
51+
node {
52+
bb_id: 2
53+
size: 6
54+
out_edges {
55+
sink: {
56+
function_index: 1
57+
bb_index: 1
58+
}
59+
weight: 80
60+
kind: RETURN
61+
}
62+
}
63+
}
64+
cfg {
65+
function_index: 1
66+
name: "bar"
67+
node {
68+
bb_id: 0
69+
size: 10
70+
out_edges {
71+
sink: {
72+
function_index: 1
73+
bb_index: 1
74+
}
75+
weight: 100
76+
kind: BRANCH_OR_FALLTHROUGH
77+
}
78+
}
79+
node {
80+
bb_id: 1
81+
size: 6
82+
out_edges {
83+
sink: {
84+
function_index: 1
85+
bb_index: 3
86+
}
87+
weight: 100
88+
kind: BRANCH_OR_FALLTHROUGH
89+
}
90+
out_edges {
91+
sink: {
92+
function_index: 0
93+
bb_index: 0
94+
}
95+
weight: 100
96+
kind: CALL
97+
}
98+
}
99+
node {
100+
bb_id: 2
101+
size: 8
102+
out_edges {
103+
sink: {
104+
function_index: 1
105+
bb_index: 4
106+
}
107+
weight: 2
108+
kind: BRANCH_OR_FALLTHROUGH
109+
}
110+
out_edges {
111+
sink: {
112+
function_index: 1
113+
bb_index: 5
114+
}
115+
weight: 0
116+
kind: BRANCH_OR_FALLTHROUGH
117+
}
118+
}
119+
node {
120+
bb_id: 3
121+
size: 6
122+
}
123+
node {
124+
bb_id: 4
125+
size: 10
126+
}
127+
node {
128+
bb_id: 5
129+
size: 7
130+
}
131+
}
132+
133+
cfg {
134+
function_index: 4
135+
name: "baz"
136+
node {
137+
bb_id: 0
138+
size: 8
139+
}
140+
}
141+
cfg {
142+
function_index: 100
143+
name: "qux"
144+
node {
145+
bb_id: 0
146+
size: 12
147+
out_edges {
148+
sink: {
149+
function_index: 100
150+
bb_index: 0
151+
}
152+
weight: 10
153+
kind: CALL
154+
}
155+
}
156+
}

0 commit comments

Comments
 (0)