Skip to content

Commit 20a8b41

Browse files
dhoekwatercopybara-github
authored andcommitted
Add testdata for a function with a loop that contains two conditionals
PiperOrigin-RevId: 696656398
1 parent cbe363a commit 20a8b41

File tree

3 files changed

+186
-0
lines changed

3 files changed

+186
-0
lines changed

propeller/testdata/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ exports_files([
5252
"test_comdat.h",
5353
"test_comdat_1.cc",
5454
"test_comdat_2.cc",
55+
"three_branches.protobuf",
56+
"two_conditionals_in_loop.protobuf",
5557
])
5658

5759
# This rule generates a binary with comdat functions.
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
## CFG consisting of a function with three conditionals.
2+
## TODO(b/160191690) Change symbol names once unary encoding is deprecated.
3+
##
4+
## foo
5+
## / \
6+
## 0 / \100
7+
## / \
8+
## v v
9+
## aa.BB.foo a.BB.foo
10+
## | \ | \
11+
## | \ | \
12+
## 10| 0\ |80 \20
13+
## | \ | \
14+
## v \ | \
15+
## raa.BB.foo v v v
16+
## rraa.BB.foo rrraa.BB.foo
17+
##
18+
19+
cfg {
20+
name: "foo"
21+
node {
22+
bb_id: 0
23+
size: 10
24+
out_edges {
25+
sink: {
26+
bb_index: 1
27+
}
28+
weight: 100
29+
}
30+
out_edges {
31+
sink: {
32+
bb_index: 2
33+
}
34+
weight: 0
35+
}
36+
}
37+
node {
38+
bb_id: 1
39+
size: 4
40+
out_edges {
41+
sink: {
42+
bb_index: 4
43+
}
44+
weight: 80
45+
}
46+
out_edges {
47+
sink: {
48+
bb_index: 5
49+
}
50+
weight: 20
51+
}
52+
}
53+
node {
54+
bb_id: 2
55+
size: 6
56+
out_edges {
57+
sink: {
58+
bb_index: 3
59+
}
60+
weight: 10
61+
}
62+
out_edges {
63+
sink: {
64+
bb_index: 4
65+
}
66+
weight: 0
67+
kind: BRANCH_OR_FALLTHROUGH
68+
}
69+
}
70+
node {
71+
bb_id: 3
72+
size: 2
73+
}
74+
node {
75+
bb_id: 4
76+
size: 6
77+
}
78+
node {
79+
bb_id: 5
80+
size: 4
81+
}
82+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
## CFG consisting of a function with two conditionals in a small-trip-count
2+
## loop.
3+
## foo
4+
## |
5+
## 15 |
6+
## v
7+
## +----> foo.1
8+
## | |\
9+
## | | \10
10+
## | | \
11+
## | | v
12+
## 10 | 15 | foo.3 --+
13+
## | | / |
14+
## | | / 9 |
15+
## | | / |
16+
## | vv | 1
17+
## +---- foo.2 |
18+
## | |
19+
## 14 | |
20+
## v |
21+
## foo.4 <-------+
22+
23+
cfg {
24+
name: "foo"
25+
function_index: 22
26+
node {
27+
bb_id: 0
28+
size: 10
29+
out_edges {
30+
sink : {
31+
function_index: 22
32+
bb_index: 1
33+
}
34+
weight: 15
35+
kind: BRANCH_OR_FALLTHROUGH
36+
}
37+
}
38+
node {
39+
bb_id: 1
40+
size: 8
41+
out_edges {
42+
sink : {
43+
function_index: 22
44+
bb_index: 2
45+
}
46+
weight: 15
47+
kind: BRANCH_OR_FALLTHROUGH
48+
}
49+
out_edges {
50+
sink : {
51+
function_index: 22
52+
bb_index: 3
53+
}
54+
weight: 10
55+
kind: BRANCH_OR_FALLTHROUGH
56+
}
57+
}
58+
node {
59+
bb_id: 2
60+
size: 4
61+
out_edges {
62+
sink : {
63+
function_index: 22
64+
bb_index: 1
65+
}
66+
weight: 10
67+
kind: BRANCH_OR_FALLTHROUGH
68+
}
69+
out_edges {
70+
sink : {
71+
function_index: 22
72+
bb_index: 4
73+
}
74+
weight: 14
75+
kind: BRANCH_OR_FALLTHROUGH
76+
}
77+
}
78+
node {
79+
bb_id: 3
80+
size: 6
81+
out_edges {
82+
sink : {
83+
function_index: 22
84+
bb_index: 4
85+
}
86+
weight: 1
87+
kind: BRANCH_OR_FALLTHROUGH
88+
}
89+
out_edges {
90+
sink : {
91+
function_index: 22
92+
bb_index: 2
93+
}
94+
weight: 9
95+
kind: BRANCH_OR_FALLTHROUGH
96+
}
97+
}
98+
node {
99+
bb_id: 4
100+
size: 2
101+
}
102+
}

0 commit comments

Comments
 (0)