[llvm] [BasicBlockSections] Introduce the basic block sections profile version 1. (PR #65506)

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 11:43:09 PDT 2023


================
@@ -46,34 +47,121 @@ BasicBlockSectionsProfileReader::getBBClusterInfoForFunction(
              : std::pair(false, SmallVector<BBClusterInfo>{});
 }
 
-// Basic Block Sections can be enabled for a subset of machine basic blocks.
-// This is done by passing a file containing names of functions for which basic
-// block sections are desired.  Additionally, machine basic block ids of the
-// functions can also be specified for a finer granularity. Moreover, a cluster
-// of basic blocks could be assigned to the same section.
-// Optionally, a debug-info filename can be specified for each function to allow
-// distinguishing internal-linkage functions of the same name.
-// A file with basic block sections for all of function main and three blocks
-// for function foo (of which 1 and 2 are placed in a cluster) looks like this:
-// (Profile for function foo is only loaded when its debug-info filename
-// matches 'path/to/foo_file.cc').
-// ----------------------------
-// list.txt:
-// !main
-// !foo M=path/to/foo_file.cc
-// !!1 2
-// !!4
-Error BasicBlockSectionsProfileReader::ReadProfile() {
-  assert(MBuf);
-  line_iterator LineIt(*MBuf, /*SkipBlanks=*/true, /*CommentMarker=*/'#');
+// Reads the version 1 basic block sections profile. Profile for each function
+// is encoded as follows:
+//   m <module_name>
+//   f <function_name_1> <function_name_2> ...
+//   c <bb_id_1> <bb_id_2> <bb_id_3>
+//   c <bb_id_4> <bb_id_5>
+//   ...
+// Module name specifier (starting with 'm') is optional and allows
+// distinguishing profile for internal-linkage functions with the same name. If
+// not specified, it will apply to any function with the same name. Function
+// name specifier (starting with 'f') can specify multiple function name
+// aliases. Basic block clusters are specified by 'c' and specify the cluster of
+// basic blocks, and the internal order in which they must be placed in the same
+// section.
+Error BasicBlockSectionsProfileReader::ReadV1Profile() {
----------------
tmsri wrote:

We have to put an expiry date on "ReadV0Profile".  create_llvm_prof has to be updated to start producing the new format and we should obsolete and delete the old function soon-ish.

https://github.com/llvm/llvm-project/pull/65506


More information about the llvm-commits mailing list