From 7ea2747d31c083c06a810f79b67172fac38df095 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 with two conditionals that eventually join PiperOrigin-RevId: 696656402 --- propeller/testdata/BUILD | 2 + propeller/testdata/nested_loop.protobuf | 111 ++++++++++++++++++ .../simple_conditionals_join.protobuf | 93 +++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 propeller/testdata/nested_loop.protobuf create mode 100644 propeller/testdata/simple_conditionals_join.protobuf diff --git a/propeller/testdata/BUILD b/propeller/testdata/BUILD index 6198b5d18d3..9a9c1addfbd 100644 --- a/propeller/testdata/BUILD +++ b/propeller/testdata/BUILD @@ -40,11 +40,13 @@ exports_files([ "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", "test_comdat.h", "test_comdat_1.cc", "test_comdat_2.cc", 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 + } +}