From 4a12d592f1ea63b3a7d85a5faacd62d8f11a376d Mon Sep 17 00:00:00 2001 From: Daniel Hoekwater Date: Thu, 14 Nov 2024 14:43:19 -0800 Subject: [PATCH] Add testdata for a function that consists of two large basic blocks PiperOrigin-RevId: 696656397 --- propeller/testdata/BUILD | 12 ++ .../testdata/all_cold_landing_pads.protobuf | 139 ++++++++++++++++ .../testdata/call_from_simple_loop.protobuf | 87 ++++++++++ .../hot_and_cold_landing_pads.protobuf | 140 ++++++++++++++++ .../testdata/loop_no_entry_no_exit.protobuf | 71 ++++++++ .../testdata/multiple_cold_blocks.protobuf | 41 +++++ propeller/testdata/nested_loop.protobuf | 111 +++++++++++++ .../simple_conditionals_join.protobuf | 93 +++++++++++ propeller/testdata/simple_loop.protobuf | 94 +++++++++++ .../testdata/simple_multi_function.protobuf | 156 ++++++++++++++++++ propeller/testdata/three_branches.protobuf | 82 +++++++++ .../two_conditionals_in_loop.protobuf | 102 ++++++++++++ propeller/testdata/two_large_blocks.protobuf | 76 +++++++++ 13 files changed, 1204 insertions(+) create mode 100644 propeller/testdata/all_cold_landing_pads.protobuf create mode 100644 propeller/testdata/call_from_simple_loop.protobuf create mode 100644 propeller/testdata/hot_and_cold_landing_pads.protobuf create mode 100644 propeller/testdata/loop_no_entry_no_exit.protobuf create mode 100644 propeller/testdata/multiple_cold_blocks.protobuf create mode 100644 propeller/testdata/nested_loop.protobuf create mode 100644 propeller/testdata/simple_conditionals_join.protobuf create mode 100644 propeller/testdata/simple_loop.protobuf create mode 100644 propeller/testdata/simple_multi_function.protobuf create mode 100644 propeller/testdata/three_branches.protobuf create mode 100644 propeller/testdata/two_conditionals_in_loop.protobuf create mode 100644 propeller/testdata/two_large_blocks.protobuf diff --git a/propeller/testdata/BUILD b/propeller/testdata/BUILD index bf7e5ab2e31..be928bcdd5b 100644 --- a/propeller/testdata/BUILD +++ b/propeller/testdata/BUILD @@ -30,19 +30,31 @@ _LLVM_PROPELLER_TESTDATA_TOOLCHAINS = [ ] exports_files([ + "all_cold_landing_pads.protobuf", "bimodal_sample.bin", "bimodal_sample.x.bin", + "call_from_simple_loop.protobuf", "clang_v0_labels.binary", + "hot_and_cold_landing_pads.protobuf", "llvm_function_samples.binary", "llvm_function_samples_perf.data", + "loop_no_entry_no_exit.protobuf", + "multiple_cold_blocks.protobuf", + "nested_loop.protobuf", "propeller_sample.protobuf", "propeller_sample_1.bin", "sample.bin", "sample.c", "sample_section.bin", + "simple_conditionals_join.protobuf", + "simple_loop.protobuf", + "simple_multi_function.protobuf", "test_comdat.h", "test_comdat_1.cc", "test_comdat_2.cc", + "three_branches.protobuf", + "two_conditionals_in_loop.protobuf", + "two_large_blocks.protobuf", ]) # This rule generates a binary with comdat functions. diff --git a/propeller/testdata/all_cold_landing_pads.protobuf b/propeller/testdata/all_cold_landing_pads.protobuf new file mode 100644 index 00000000000..5ac6622dbc2 --- /dev/null +++ b/propeller/testdata/all_cold_landing_pads.protobuf @@ -0,0 +1,139 @@ +## CFG Proto for two functions: Function foo has two exception handling landing +## pads which are both cold. +## +## +## 20 +## +-----------------+ +## | | +## v 20 | +## foo -------------> bar +## / \ +## 20 / \ 0 +## v v [eh pad] +## foo.1 foo.2 ----+ +## / \ | +## 20 / \ 0 | +## v v | +## foo.4 foo.3 [eh pad] | +## \ / | 0 +## 20 \ /0 | +## \ / | +## v v | +## foo.5 <-------------+ +## + +cfg { + name: "foo" + function_index: 100 + node { + bb_id: 0 + size: 10 + out_edges { + sink : { + function_index: 100 + bb_index: 1 + } + weight: 20 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 100 + bb_index: 2 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 200 + bb_index: 0 + } + weight: 20 + kind: CALL + } + } + node { + bb_id: 1 + size: 10 + out_edges { + sink : { + function_index: 100 + bb_index: 4 + } + weight: 20 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 100 + bb_index: 3 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 10 + metadata { + is_landing_pad: true + } + out_edges { + sink : { + function_index: 100 + bb_index: 5 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 10 + metadata { + is_landing_pad: true + } out_edges { + sink : { + function_index: 100 + bb_index: 5 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 4 + size: 10 + out_edges { + sink : { + function_index: 100 + bb_index: 5 + } + weight: 20 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 5 + size: 10 + } +} + +cfg { + name: "bar" + function_index: 200 + node { + bb_id: 0 + size: 10 + out_edges { + sink : { + function_index: 100 + bb_index: 0 + } + weight: 20 + kind: RETURN + } + } +} + diff --git a/propeller/testdata/call_from_simple_loop.protobuf b/propeller/testdata/call_from_simple_loop.protobuf new file mode 100644 index 00000000000..acf90786901 --- /dev/null +++ b/propeller/testdata/call_from_simple_loop.protobuf @@ -0,0 +1,87 @@ +## CFG consisting of a function calling another function in a simple loop. +## +## foo <------- baz +## | 100 +## 5 | +## | +## v 100 +## +---> foo.1 -------> bar +## | | +## | 100 |100 +## | | +## | v +## +--- foo.2 +## + +cfg { + name: "foo" + function_index: 1 + node { + bb_id: 0 + size: 10 + out_edges { + sink : { + function_index: 1 + bb_index: 1 + } + weight: 5 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 4 + out_edges { + sink : { + function_index: 1 + bb_index: 2 + } + weight: 100 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 2 + bb_index: 0 + } + weight: 100 + kind: CALL + } + } + node { + bb_id: 2 + size: 6 + out_edges { + sink : { + function_index: 1 + bb_index: 1 + } + weight: 100 + kind: BRANCH_OR_FALLTHROUGH + } + } +} +cfg { + name: "bar" + function_index: 2 + node { + bb_id: 0 + size: 2 + } +} +cfg { + name: "baz" + function_index: 3 + node { + bb_id: 0 + size: 6 + out_edges { + sink : { + function_index: 1 + bb_index: 0 + } + weight: 100 + kind: CALL + } + } +} diff --git a/propeller/testdata/hot_and_cold_landing_pads.protobuf b/propeller/testdata/hot_and_cold_landing_pads.protobuf new file mode 100644 index 00000000000..9368010f3fd --- /dev/null +++ b/propeller/testdata/hot_and_cold_landing_pads.protobuf @@ -0,0 +1,140 @@ +## CFG Proto for two functions: Function foo has two exception handling landing +## pads. One is cold, the other is hot. +## +## +## 10 +## +-----------------+ +## | | +## v 20 | +## foo -------------> bar +## / \ +## 10 / \ 10 +## v v +## foo.1 foo.2 ----+ +## / \ | +## 10 / \ 0 | +## v v | +## foo.4 foo.3 [eh pad] | +## \ / | 10 +## 10 \ /0 | +## \ / | +## v v | +## foo.5 <--------------+ +## + +cfg { + name: "foo" + function_index: 10 + node { + bb_id: 0 + size: 10 + out_edges { + sink: { + function_index: 10 + bb_index: 1 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 10 + bb_index: 2 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 20 + bb_index: 0 + } + weight: 20 + kind: CALL + } + } + node { + bb_id: 1 + size: 10 + out_edges { + sink: { + function_index: 10 + bb_index: 4 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 10 + bb_index: 3 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 10 + metadata { + is_landing_pad : true + } + out_edges { + sink: { + function_index: 10 + bb_index: 5 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 10 + metadata { + is_landing_pad: true + } + out_edges { + sink: { + function_index: 10 + bb_index: 5 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 4 + size: 10 + out_edges { + sink: { + function_index: 10 + bb_index: 5 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 5 + size: 10 + } +} + +cfg { + name: "bar" + function_index: 20 + node { + bb_id: 0 + size: 10 + out_edges { + sink: { + function_index: 10 + bb_index: 0 + } + weight: 10 + kind: RETURN + } + } +} + diff --git a/propeller/testdata/loop_no_entry_no_exit.protobuf b/propeller/testdata/loop_no_entry_no_exit.protobuf new file mode 100644 index 00000000000..adf53e2a32b --- /dev/null +++ b/propeller/testdata/loop_no_entry_no_exit.protobuf @@ -0,0 +1,71 @@ +## CFG Proto for a function consisting of a simple loop with cold entry and exit +## edges. +## +## foo +## | +## |0 +## V +## a.BB.foo <--+ +## | | +## | |45 +## |40 | +## | | +## v | +## aa.BB.foo ---+ +## | +## | 0 +## v +## raa.BB.foo + +cfg { + name: "foo" + function_index: 0 + node { + bb_id: 0 + size: 10 + out_edges { + sink: { + function_index: 0 + bb_index: 1 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 6 + out_edges { + sink: { + function_index: 0 + bb_index: 2 + } + weight: 40 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 4 + out_edges { + sink: { + function_index: 0 + bb_index: 3 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 0 + bb_index: 1 + } + weight: 45 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 3 + } +} diff --git a/propeller/testdata/multiple_cold_blocks.protobuf b/propeller/testdata/multiple_cold_blocks.protobuf new file mode 100644 index 00000000000..fc41af16360 --- /dev/null +++ b/propeller/testdata/multiple_cold_blocks.protobuf @@ -0,0 +1,41 @@ +## CFG Proto for a function consisting of three cold blocks and two hot blocks. +## +## foo +## +## foo.2 foo.4 +## +## 40 +## foo.3 -----> foo.1 + +cfg { + name: "foo" + function_index: 999 + node { + bb_id: 0 + size: 10 + } + node { + bb_id: 1 + size: 6 + } + node { + bb_id: 2 + size: 5 + } + node { + bb_id: 3 + size: 4 + out_edges { + sink : { + function_index: 999 + bb_index: 1 + } + weight: 40 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 4 + size: 3 + } +} diff --git a/propeller/testdata/nested_loop.protobuf b/propeller/testdata/nested_loop.protobuf new file mode 100644 index 00000000000..76a3ce3f411 --- /dev/null +++ b/propeller/testdata/nested_loop.protobuf @@ -0,0 +1,111 @@ +## CFG Proto for a function consisting of a nested loop. +## Ordinals are intentionally out-of-order. +## +## [1] foo +## | +## |5 +## V +## [4] ara.BB.foo <-----+ +## | | +## 60 | | +## V | +## [2] a.BB.foo <--+ | +## | | | +## 600 | 550 | | 40 +## V | | +## [5] aara.BB.foo ---+ | +## | | +## 55 | | +## V | +## [6] aaara.BB.foo -------+ +## | +## 10 | +## V +## [3] ra.BB.foo +## +cfg { + name: "foo" + function_index: 1 + node { + bb_id: 0 + size: 10 + out_edges { + sink: { + function_index: 1 + bb_index: 3 + } + weight: 5 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 10 + out_edges { + sink: { + function_index: 1 + bb_index: 4 + } + weight: 600 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 10 + } + node { + bb_id: 3 + size: 10 + out_edges { + sink: { + function_index: 1 + bb_index: 1 + } + weight: 60 + kind: BRANCH_OR_FALLTHROUGH + } + } + + node { + bb_id: 4 + size: 10 + out_edges { + sink: { + function_index: 1 + bb_index: 5 + } + weight: 55 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 1 + bb_index: 1 + } + weight: 550 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 5 + size: 10 + out_edges { + sink: { + function_index: 1 + bb_index: 3 + } + weight: 40 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 1 + bb_index: 2 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + +} diff --git a/propeller/testdata/simple_conditionals_join.protobuf b/propeller/testdata/simple_conditionals_join.protobuf new file mode 100644 index 00000000000..350018c55c1 --- /dev/null +++ b/propeller/testdata/simple_conditionals_join.protobuf @@ -0,0 +1,93 @@ +## CFG consisting of a function with two conditionals which eventually join on +## a single return basic block. In addition, size of foo.2 is zero. +## +## foo +## | \ +## | \110 +## | \ +## | v +## 150| foo.1 +## | / \ +## | /100 \10 +## | / \ +## v v v +## foo.2 foo.3 +## \ / +## \ / +## 250 \ /10 +## \ / +## v v +## foo.4 + +cfg { + name: "foo" + function_index: 10 + node { + bb_id: 0 + size: 10 + out_edges { + sink { + function_index: 10 + bb_index: 1 + } + weight: 110 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink { + function_index: 10 + bb_index: 2 + } + weight: 150 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 4 + out_edges { + sink { + function_index: 10 + bb_index: 2 + } + weight: 100 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink { + function_index: 10 + bb_index: 3 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 0 + out_edges { + sink { + function_index: 10 + bb_index: 4 + } + weight: 250 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 2 + out_edges { + sink { + function_index: 10 + bb_index: 4 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 4 + size: 2 + } +} diff --git a/propeller/testdata/simple_loop.protobuf b/propeller/testdata/simple_loop.protobuf new file mode 100644 index 00000000000..a1b4edc447d --- /dev/null +++ b/propeller/testdata/simple_loop.protobuf @@ -0,0 +1,94 @@ +## CFG Proto for a function consisting of a conditional and a loop on one side +## of the conditional. +## +## foo +## | +## |5 +## V +## a.BB.foo <--+ +## / \ | +## 0/ \95 |90 +## / \ | +## v \ | +## aa.BB.foo v | +## \ aaa.BB.foo +## \ / +## \ / +## 0\ /10 +## \ / +## v v +## raaa.BB.foo + +cfg { + name: "foo" + name: "foo.alias" + function_index: 0 + node { + bb_id: 0 + size: 10 + out_edges { + sink: { + function_index: 0 + bb_index: 1 + } + weight: 5 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 6 + out_edges { + sink: { + function_index: 0 + bb_index: 2 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 0 + bb_index: 3 + } + weight: 95 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 4 + out_edges { + sink: { + function_index: 0 + bb_index: 4 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 4 + out_edges { + sink: { + function_index: 0 + bb_index: 1 + } + weight: 90 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 0 + bb_index: 4 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 4 + size: 6 + } +} diff --git a/propeller/testdata/simple_multi_function.protobuf b/propeller/testdata/simple_multi_function.protobuf new file mode 100644 index 00000000000..6dbd66c5593 --- /dev/null +++ b/propeller/testdata/simple_multi_function.protobuf @@ -0,0 +1,156 @@ +## +## bar +## / \ +## 100 / \ 0 +## / \ +## 100 (CALL) v v 0 CALL +## foo <------------ bar.1 bar.2 -----> bar.5 baz qux -----+ +## / \ ^ ^ \ | ^ | +## 20 / \80 80| | \100 | | 10 | +## v v | | \ | 2 +-------+ +## foo.1 foo.2 --------+ | v v +## | (RETURN) | bar.3 bar.4 +## | 20 (RETURN) | +## +----------------------+ + +cfg { + function_index: 0 + name: "foo" + node { + bb_id: 0 + size: 8 + out_edges { + sink: { + function_index: 0 + bb_index: 1 + } + weight: 20 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 0 + bb_index: 2 + } + weight: 80 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 6 + out_edges { + sink: { + function_index: 1 + bb_index: 1 + } + weight: 20 + kind: RETURN + } + } + node { + bb_id: 2 + size: 6 + out_edges { + sink: { + function_index: 1 + bb_index: 1 + } + weight: 80 + kind: RETURN + } + } +} +cfg { + function_index: 1 + name: "bar" + node { + bb_id: 0 + size: 10 + out_edges { + sink: { + function_index: 1 + bb_index: 1 + } + weight: 100 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 6 + out_edges { + sink: { + function_index: 1 + bb_index: 3 + } + weight: 100 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 0 + bb_index: 0 + } + weight: 100 + kind: CALL + } + } + node { + bb_id: 2 + size: 8 + out_edges { + sink: { + function_index: 1 + bb_index: 4 + } + weight: 2 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink: { + function_index: 1 + bb_index: 5 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 6 + } + node { + bb_id: 4 + size: 10 + } + node { + bb_id: 5 + size: 7 + } +} + +cfg { + function_index: 4 + name: "baz" + node { + bb_id: 0 + size: 8 + } +} +cfg { + function_index: 100 + name: "qux" + node { + bb_id: 0 + size: 12 + out_edges { + sink: { + function_index: 100 + bb_index: 0 + } + weight: 10 + kind: CALL + } + } +} diff --git a/propeller/testdata/three_branches.protobuf b/propeller/testdata/three_branches.protobuf new file mode 100644 index 00000000000..38f36b9ccae --- /dev/null +++ b/propeller/testdata/three_branches.protobuf @@ -0,0 +1,82 @@ +## CFG consisting of a function with three conditionals. +## TODO(b/160191690) Change symbol names once unary encoding is deprecated. +## +## foo +## / \ +## 0 / \100 +## / \ +## v v +## aa.BB.foo a.BB.foo +## | \ | \ +## | \ | \ +## 10| 0\ |80 \20 +## | \ | \ +## v \ | \ +## raa.BB.foo v v v +## rraa.BB.foo rrraa.BB.foo +## + +cfg { + name: "foo" + node { + bb_id: 0 + size: 10 + out_edges { + sink: { + bb_index: 1 + } + weight: 100 + } + out_edges { + sink: { + bb_index: 2 + } + weight: 0 + } + } + node { + bb_id: 1 + size: 4 + out_edges { + sink: { + bb_index: 4 + } + weight: 80 + } + out_edges { + sink: { + bb_index: 5 + } + weight: 20 + } + } + node { + bb_id: 2 + size: 6 + out_edges { + sink: { + bb_index: 3 + } + weight: 10 + } + out_edges { + sink: { + bb_index: 4 + } + weight: 0 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 2 + } + node { + bb_id: 4 + size: 6 + } + node { + bb_id: 5 + size: 4 + } +} diff --git a/propeller/testdata/two_conditionals_in_loop.protobuf b/propeller/testdata/two_conditionals_in_loop.protobuf new file mode 100644 index 00000000000..9b546613e4b --- /dev/null +++ b/propeller/testdata/two_conditionals_in_loop.protobuf @@ -0,0 +1,102 @@ +## CFG consisting of a function with two conditionals in a small-trip-count +## loop. +## foo +## | +## 15 | +## v +## +----> foo.1 +## | |\ +## | | \10 +## | | \ +## | | v +## 10 | 15 | foo.3 --+ +## | | / | +## | | / 9 | +## | | / | +## | vv | 1 +## +---- foo.2 | +## | | +## 14 | | +## v | +## foo.4 <-------+ + +cfg { + name: "foo" + function_index: 22 + node { + bb_id: 0 + size: 10 + out_edges { + sink : { + function_index: 22 + bb_index: 1 + } + weight: 15 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 8 + out_edges { + sink : { + function_index: 22 + bb_index: 2 + } + weight: 15 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 22 + bb_index: 3 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 4 + out_edges { + sink : { + function_index: 22 + bb_index: 1 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 22 + bb_index: 4 + } + weight: 14 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 3 + size: 6 + out_edges { + sink : { + function_index: 22 + bb_index: 4 + } + weight: 1 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 22 + bb_index: 2 + } + weight: 9 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 4 + size: 2 + } +} diff --git a/propeller/testdata/two_large_blocks.protobuf b/propeller/testdata/two_large_blocks.protobuf new file mode 100644 index 00000000000..9143fc8f427 --- /dev/null +++ b/propeller/testdata/two_large_blocks.protobuf @@ -0,0 +1,76 @@ +## CFG consisting of two function foo and bar with two very large blocks. +## One function (foo) has two very large blocks ( >= 100000 bytes). +## +## foo [very large block] +## | +## | 100 +## | +## v 10 10 +## foo.1 ------> foo.3 ---------> bar +## | +## | 100 +## | +## v +## foo.2 [very large block] + +cfg { + function_index: 0 + name: "foo" + node { + bb_id: 0 + size: 100000 + out_edges { + sink : { + function_index: 0 + bb_index: 1 + } + weight: 100 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 1 + size: 10 + out_edges { + sink : { + function_index: 0 + bb_index: 2 + } + weight: 100 + kind: BRANCH_OR_FALLTHROUGH + } + out_edges { + sink : { + function_index: 0 + bb_index: 3 + } + weight: 10 + kind: BRANCH_OR_FALLTHROUGH + } + } + node { + bb_id: 2 + size: 100001 + } + node { + bb_id: 3 + size: 11 + out_edges { + sink : { + function_index: 1 + bb_index: 0 + } + weight: 10 + kind: CALL + } + } +} + +cfg { + function_index: 1 + name: "bar" + node { + bb_id: 0 + size: 20 + } +}