From e91629f5540b4b2bc01ada3f4294c01ef2794fd3 Mon Sep 17 00:00:00 2001 From: Daniel Hoekwater Date: Thu, 14 Nov 2024 14:43:20 -0800 Subject: [PATCH] Add testdata for a function with a simple loop PiperOrigin-RevId: 696656413 --- propeller/testdata/BUILD | 1 + propeller/testdata/simple_loop.protobuf | 94 +++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 propeller/testdata/simple_loop.protobuf diff --git a/propeller/testdata/BUILD b/propeller/testdata/BUILD index 9a9c1addfbd..1f188831b5c 100644 --- a/propeller/testdata/BUILD +++ b/propeller/testdata/BUILD @@ -47,6 +47,7 @@ exports_files([ "sample.c", "sample_section.bin", "simple_conditionals_join.protobuf", + "simple_loop.protobuf", "test_comdat.h", "test_comdat_1.cc", "test_comdat_2.cc", 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 + } +}