-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BasicBlockSections] Introduce the basic block sections profile version 1. #65506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f <function name 1> <function name 2>
So func name 1 and func name 2 are aliaes, right?
Correct. Fixed the function comment. |
ping. @tmsri |
Another friendly ping for review. |
…on 1. llvm#65506 This patch introduces a new version for the basic block sections profile as was requested in D158442, while keeping backward compatibility for the old version. The new encoding is 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 profiles for internal-linkage functions with the same name. If not specified, profile will be applied to any function with the same name. Function name specifier (starting with 'f') can specify multiple function name aliases. Finally, 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.
You can test this locally with the following command:git-clang-format --diff 46d5d264fc66a017bbd0182b2b5fcc0f3f23d3be 8a1893b39119166b6de06c1d182b967015518c3c -- llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp View the diff from clang-format here.diff --git a/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp b/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
index 30f0cbd25316..ef5f1251f532 100644
--- a/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
@@ -86,14 +86,14 @@ Error BasicBlockSectionsProfileReader::ReadV1Profile() {
switch (Specifier) {
case '@':
break;
- case 'm': // Module name speicifer.
+ case 'm': // Module name speicifer.
if (Values.size() != 1) {
return createProfileParseError(Twine("invalid module name value: '") +
S + "'");
}
DIFilename = sys::path::remove_leading_dotslash(Values[0]);
continue;
- case 'f': { // Function names specifier.
+ case 'f': { // Function names specifier.
bool FunctionFound = any_of(Values, [&](StringRef Alias) {
auto It = FunctionNameToDIFilename.find(Alias);
// No match if this function name is not found in this module.
@@ -129,7 +129,7 @@ Error BasicBlockSectionsProfileReader::ReadV1Profile() {
DIFilename = "";
continue;
}
- case 'c': // Basic block cluster specifier.
+ case 'c': // Basic block cluster specifier.
// Skip the profile when we the profile iterator (FI) refers to the
// past-the-end element.
if (FI == ProgramBBClusterInfo.end())
|
This patch introduces a new version for the basic block sections profile as was requested in D158442, while keeping backward compatibility for the old version.
The new encoding is as follows:
Module name specifier (starting with 'm') is optional and allows distinguishing profiles for internal-linkage functions with the same name. If not specified, profile will be applied to any function with the same name.
Function name specifier (starting with 'f') can specify multiple function name aliases.
Finally, 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.