Skip to content

Commit 88b5806

Browse files
dhoekwatercopybara-github
authored andcommitted
Add testdata for a function with three conditionals
PiperOrigin-RevId: 696656401
1 parent 390f4a4 commit 88b5806

6 files changed

+541
-0
lines changed

propeller/testdata/BUILD

+5
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,19 @@ exports_files([
4040
"llvm_function_samples_perf.data",
4141
"loop_no_entry_no_exit.protobuf",
4242
"multiple_cold_blocks.protobuf",
43+
"nested_loop.protobuf",
4344
"propeller_sample.protobuf",
4445
"propeller_sample_1.bin",
4546
"sample.bin",
4647
"sample.c",
4748
"sample_section.bin",
49+
"simple_conditionals_join.protobuf",
50+
"simple_loop.protobuf",
51+
"simple_multi_function.protobuf",
4852
"test_comdat.h",
4953
"test_comdat_1.cc",
5054
"test_comdat_2.cc",
55+
"three_branches.protobuf",
5156
])
5257

5358
# This rule generates a binary with comdat functions.
+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+
}
+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+
}

0 commit comments

Comments
 (0)