[llvm] [Sample Profile] Expand functionality of llvm-profdata function filter (PR #101615)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 11:33:04 PDT 2024


================
@@ -475,3 +478,40 @@ EXIT STATUS
 
 :program:`llvm-profdata` returns 1 if the command is omitted or is invalid,
 if it cannot read input files, or if there is a mismatch between their data.
+
+.. _profdata-canonical:
+
+SAMPLE PROFILE CANONICAL FUNCTION NAME
+--------------------------------------
+
+The canonical name of a (possibly inlined) function in sample profile is
+defined as the following:
+
+::
+
+    <canonical name> ::= <top level name>
+                     ::= <top level name> <inlined callsites>
+
+    <top level name> ::= <FunctionID> # for context-less profile
+                     ::= "[" (<FunctionID> | <FunctionID> <inlined callsites>) "]" # for CSSPGO profile
+
+    <inlined callsites> ::= <SampleContextFrame>
+                        ::= <SampleContextFrame> <inlined callsites>
+
+    <SampleContextFrame> ::= ":" <LineLocation> " @ " <FunctionID>
+
+    <LineLocation> ::= <number>
+                   ::= <number> "." <number> # with discriminator
+
+    <FunctionID> ::= <number> # for MD5 profile
+                 ::= <string> # for non-MD5 profile
+
+For brevity we do not check for the validity of the mangled name, and the only
+restrictions are that it cannot begin with a number or space, and it cannot
+contain the inline context separator " @ ".
----------------
WenleiHe wrote:

Mangled name doesn't allow space " ", so no need to exclude " @ ". (and ofc "@" is allowed)

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


More information about the llvm-commits mailing list