Merged
Conversation
Member
|
@llvm/pr-subscribers-bolt Author: Amir Ayupov (aaupov) ChangesMake EntryTy a thin wrapper struct. Full diff: https://github.com/llvm/llvm-project/pull/91812.diff 2 Files Affected:
diff --git a/bolt/include/bolt/Profile/BoltAddressTranslation.h b/bolt/include/bolt/Profile/BoltAddressTranslation.h
index 68b993ee363cc..6f14390313efe 100644
--- a/bolt/include/bolt/Profile/BoltAddressTranslation.h
+++ b/bolt/include/bolt/Profile/BoltAddressTranslation.h
@@ -178,14 +178,9 @@ class BoltAddressTranslation {
public:
/// Map basic block input offset to a basic block index and hash pair.
class BBHashMapTy {
- class EntryTy {
+ struct EntryTy {
unsigned Index;
size_t Hash;
-
- public:
- unsigned getBBIndex() const { return Index; }
- size_t getBBHash() const { return Hash; }
- EntryTy(unsigned Index, size_t Hash) : Index(Index), Hash(Hash) {}
};
std::map<uint32_t, EntryTy> Map;
@@ -201,15 +196,15 @@ class BoltAddressTranslation {
}
unsigned getBBIndex(uint32_t BBInputOffset) const {
- return getEntry(BBInputOffset).getBBIndex();
+ return getEntry(BBInputOffset).Index;
}
size_t getBBHash(uint32_t BBInputOffset) const {
- return getEntry(BBInputOffset).getBBHash();
+ return getEntry(BBInputOffset).Hash;
}
void addEntry(uint32_t BBInputOffset, unsigned BBIndex, size_t BBHash) {
- Map.emplace(BBInputOffset, EntryTy(BBIndex, BBHash));
+ Map.emplace(BBInputOffset, EntryTy{BBIndex, BBHash});
}
size_t getNumBasicBlocks() const { return Map.size(); }
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index d02e4499014ed..49e7ecce9d2d2 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2352,7 +2352,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
YamlBB.Index = Idx;
for (auto BI = BlockMap.begin(), BE = BlockMap.end(); BI != BE; ++BI)
- YamlBF.Blocks[BI->second.getBBIndex()].Hash = BI->second.getBBHash();
+ YamlBF.Blocks[BI->second.Index].Hash = BI->second.Hash;
auto getSuccessorInfo = [&](uint32_t SuccOffset, unsigned SuccDataIdx) {
const llvm::bolt::BranchInfo &BI = Branches.Data.at(SuccDataIdx);
@@ -2392,7 +2392,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
auto BlockIt = BlockMap.upper_bound(FromOffset);
--BlockIt;
const unsigned BlockOffset = BlockIt->first;
- const unsigned BlockIndex = BlockIt->second.getBBIndex();
+ const unsigned BlockIndex = BlockIt->second.Index;
yaml::bolt::BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[BlockIndex];
const uint32_t Offset = FromOffset - BlockOffset;
for (const auto &[CallToLoc, CallToIdx] : CallTo)
|
dcci
reviewed
May 22, 2024
Member
dcci
left a comment
There was a problem hiding this comment.
Same as #91815. This doesn't seem to me it improves things significantly, and again deferring to @maksfb or @rafaelauler.
Make EntryTy a thin wrapper struct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make EntryTy a thin wrapper struct.