-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[BOLT][NFC] Rename DataAggregator::BranchInfo to TakenBranchInfo #92017
Merged
aaupov
merged 7 commits into
main
from
users/aaupov/spr/boltnfc-rename-dataaggregatorbranchinfo-to-takeninfo
May 17, 2024
Merged
[BOLT][NFC] Rename DataAggregator::BranchInfo to TakenBranchInfo #92017
aaupov
merged 7 commits into
main
from
users/aaupov/spr/boltnfc-rename-dataaggregatorbranchinfo-to-takeninfo
May 17, 2024
Conversation
This file contains 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
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
aaupov
requested review from
maksfb,
rafaelauler,
ayermolo and
dcci
as code owners
May 13, 2024 19:36
@llvm/pr-subscribers-bolt Author: Amir Ayupov (aaupov) ChangesAvoid name aliasing with llvm::bolt::BranchInfo, drop namespace Test Plan: NFC Full diff: https://github.com/llvm/llvm-project/pull/92017.diff 2 Files Affected:
diff --git a/bolt/include/bolt/Profile/DataAggregator.h b/bolt/include/bolt/Profile/DataAggregator.h
index f2fa59bcaa1a3..48f01511f4827 100644
--- a/bolt/include/bolt/Profile/DataAggregator.h
+++ b/bolt/include/bolt/Profile/DataAggregator.h
@@ -122,14 +122,14 @@ class DataAggregator : public DataReader {
uint64_t ExternCount{0};
};
- struct BranchInfo {
+ struct TakenInfo {
uint64_t TakenCount{0};
uint64_t MispredCount{0};
};
/// Intermediate storage for profile data. We save the results of parsing
/// and use them later for processing and assigning profile.
- std::unordered_map<Trace, BranchInfo, TraceHash> BranchLBRs;
+ std::unordered_map<Trace, TakenInfo, TraceHash> BranchLBRs;
std::unordered_map<Trace, FTInfo, TraceHash> FallthroughLBRs;
std::vector<AggregatedLBREntry> AggregatedLBRs;
std::unordered_map<uint64_t, uint64_t> BasicSamples;
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index 167899ccba125..0e11963c676f0 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -1464,7 +1464,7 @@ uint64_t DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
uint64_t To = getBinaryFunctionContainingAddress(LBR.To) ? LBR.To : 0;
if (!From && !To)
continue;
- BranchInfo &Info = BranchLBRs[Trace(From, To)];
+ TakenInfo &Info = BranchLBRs[Trace(From, To)];
++Info.TakenCount;
Info.MispredCount += LBR.Mispred;
}
@@ -1609,7 +1609,7 @@ void DataAggregator::processBranchEvents() {
for (const auto &AggrLBR : BranchLBRs) {
const Trace &Loc = AggrLBR.first;
- const BranchInfo &Info = AggrLBR.second;
+ const TakenInfo &Info = AggrLBR.second;
doBranch(Loc.From, Loc.To, Info.TakenCount, Info.MispredCount);
}
}
@@ -2253,13 +2253,13 @@ DataAggregator::writeAggregatedFile(StringRef OutputFilename) const {
} else {
for (const auto &KV : NamesToBranches) {
const FuncBranchData &FBD = KV.second;
- for (const llvm::bolt::BranchInfo &BI : FBD.Data) {
+ for (const BranchInfo &BI : FBD.Data) {
writeLocation(BI.From);
writeLocation(BI.To);
OutFile << BI.Mispreds << " " << BI.Branches << "\n";
++BranchValues;
}
- for (const llvm::bolt::BranchInfo &BI : FBD.EntryData) {
+ for (const BranchInfo &BI : FBD.EntryData) {
// Do not output if source is a known symbol, since this was already
// accounted for in the source function
if (BI.From.IsSymbol)
@@ -2366,7 +2366,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
};
- for (const llvm::bolt::BranchInfo &BI : Branches.Data) {
+ for (const BranchInfo &BI : Branches.Data) {
using namespace yaml::bolt;
const auto &[BlockOffset, BlockIndex] = getBlock(BI.From.Offset);
BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[BlockIndex];
@@ -2388,7 +2388,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
}
}
// Set entry counts, similar to DataReader::readProfile.
- for (const llvm::bolt::BranchInfo &BI : Branches.EntryData) {
+ for (const BranchInfo &BI : Branches.EntryData) {
if (!BlockMap.isInputBlock(BI.To.Offset)) {
if (opts::Verbosity >= 1)
errs() << "BOLT-WARNING: Unexpected EntryData in " << FuncName
|
dcci
approved these changes
May 13, 2024
I would suggest |
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.5 [skip ci]
Created using spr 1.3.5
aaupov
changed the title
[BOLT][NFC] Rename DataAggregator::BranchInfo to TakenInfo
[BOLT][NFC] Rename DataAggregator::BranchInfo to TakenBranchInfo
May 17, 2024
aaupov
changed the base branch from
users/aaupov/spr/main.boltnfc-rename-dataaggregatorbranchinfo-to-takeninfo
to
main
May 17, 2024 03:01
aaupov
deleted the
users/aaupov/spr/boltnfc-rename-dataaggregatorbranchinfo-to-takeninfo
branch
May 17, 2024 03:02
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.
Align the name to its counterpart
FTInfo
which avoids name aliasingwith llvm::bolt::BranchInfo and allows to drop namespace specifier.
Test Plan: NFC