-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[NFC][SampleFDO] Clean the unneeded field and the related loop #132376
[NFC][SampleFDO] Clean the unneeded field and the related loop #132376
Conversation
@llvm/pr-subscribers-pgo @llvm/pr-subscribers-llvm-transforms Author: Jinjie Huang (Labman-001) ChangesClean the unneeded field 'TotalCollectedSamples' and the related sum loop. Full diff: https://github.com/llvm/llvm-project/pull/132376.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 731ee7edb48c8..82d4db12586d7 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -562,12 +562,6 @@ class SampleProfileLoader final : public SampleProfileLoaderBaseImpl<Function> {
/// used to generate the current profile.
std::shared_ptr<ProfileSymbolList> PSL;
- /// Total number of samples collected in this profile.
- ///
- /// This is the sum of all the samples collected in all the functions executed
- /// at runtime.
- uint64_t TotalCollectedSamples = 0;
-
// Information recorded when we declined to inline a call site
// because we have determined it is too cold is accumulated for
// each callee function. Initially this is just the entry count.
@@ -2182,10 +2176,6 @@ bool SampleProfileLoader::runOnModule(Module &M, ModuleAnalysisManager *AM,
rejectHighStalenessProfile(M, PSI, Reader->getProfiles()))
return false;
- // Compute the total number of samples collected in this profile.
- for (const auto &I : Reader->getProfiles())
- TotalCollectedSamples += I.second.getTotalSamples();
-
auto Remapper = Reader->getRemapper();
// Populate the symbol map.
for (const auto &N_F : M.getValueSymbolTable()) {
|
@danielcdh @david-xl @dnovillo, can you help to review this? thx |
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.
I have not worked in this area of the compiler for a long time, but the change seems trivially correct.
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.
LGTM
Clean the unneeded field 'TotalCollectedSamples' and the unnecessary loop.
The field seems introduced in:https://reviews.llvm.org/D31952, and its uses were removed in: https://reviews.llvm.org/D19287, but this field and unnecessary calculation were not cleaned up.
This patch will remove these unneeded codes.