[llvm] [SampleFDO] Read call-graph matching recovered top-level function profiless (PR #101053)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 11:12:56 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff c66d25d1429fbf49c97ee9cd0195246642178cb7 c7e4a8d274fa40014647933bfe599723c530e24b --extensions h,cpp -- llvm/include/llvm/ProfileData/SampleProfReader.h llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h llvm/lib/ProfileData/SampleProfReader.cpp llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index 1fe89b9a48..f555da866f 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -860,15 +860,15 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncOffsetTable() {
std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles(
const DenseSet<StringRef> &FuncsToUse, SampleProfileMap &Profiles) {
- const uint8_t *Start = Data;
+ const uint8_t *Start = Data;
- if (Remapper) {
+ if (Remapper) {
for (auto Name : FuncsToUse) {
Remapper->insert(Name);
}
- }
+ }
- if (ProfileIsCS) {
+ if (ProfileIsCS) {
assert(useFuncOffsetList());
DenseSet<uint64_t> FuncGuidsToUse;
if (useMD5()) {
@@ -910,7 +910,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles(
return EC;
}
}
- } else if (useMD5()) {
+ } else if (useMD5()) {
assert(!useFuncOffsetList());
for (auto Name : FuncsToUse) {
auto GUID = MD5Hash(Name);
@@ -921,7 +921,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles(
if (std::error_code EC = readFuncProfile(FuncProfileAddr, Profiles))
return EC;
}
- } else if (Remapper) {
+ } else if (Remapper) {
assert(useFuncOffsetList());
for (auto NameOffset : FuncOffsetList) {
SampleContext FContext(NameOffset.first);
@@ -933,7 +933,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles(
if (std::error_code EC = readFuncProfile(FuncProfileAddr, Profiles))
return EC;
}
- } else {
+ } else {
assert(!useFuncOffsetList());
for (auto Name : FuncsToUse) {
@@ -944,32 +944,32 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles(
if (std::error_code EC = readFuncProfile(FuncProfileAddr, Profiles))
return EC;
}
- }
+ }
}
std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() {
- // Collect functions used by current module if the Reader has been
- // given a module.
- // collectFuncsFromModule uses FunctionSamples::getCanonicalFnName
- // which will query FunctionSamples::HasUniqSuffix, so it has to be
- // called after FunctionSamples::HasUniqSuffix is set, i.e. after
- // NameTable section is read.
- bool LoadFuncsToBeUsed = collectFuncsFromModule();
-
- // When LoadFuncsToBeUsed is false, we are using LLVM tool, need to read all
- // profiles.
- if (!LoadFuncsToBeUsed) {
+ // Collect functions used by current module if the Reader has been
+ // given a module.
+ // collectFuncsFromModule uses FunctionSamples::getCanonicalFnName
+ // which will query FunctionSamples::HasUniqSuffix, so it has to be
+ // called after FunctionSamples::HasUniqSuffix is set, i.e. after
+ // NameTable section is read.
+ bool LoadFuncsToBeUsed = collectFuncsFromModule();
+
+ // When LoadFuncsToBeUsed is false, we are using LLVM tool, need to read all
+ // profiles.
+ if (!LoadFuncsToBeUsed) {
while (Data < End) {
if (std::error_code EC = readFuncProfile(Data))
return EC;
}
assert(Data == End && "More data is read than expected");
- } else {
+ } else {
// Load function profiles on demand.
if (std::error_code EC = readFuncProfiles(FuncsToUse, Profiles))
return EC;
Data = End;
- }
+ }
assert((CSProfileCount == 0 || CSProfileCount == Profiles.size()) &&
"Cannot have both context-sensitive and regular profile");
assert((!CSProfileCount || ProfileIsCS) &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/101053
More information about the llvm-commits
mailing list