Skip to content

Commit 9f15aa0

Browse files
authored
[BOLT][NFC] Rename DataAggregator::BranchInfo to TakenBranchInfo
Align the name to its counterpart `FTInfo` which avoids name aliasing with llvm::bolt::BranchInfo and allows to drop namespace specifier. Test Plan: NFC Reviewers: maksfb, rafaelauler, ayermolo, dcci Reviewed By: dcci Pull Request: #92017
1 parent 5529278 commit 9f15aa0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ class DataAggregator : public DataReader {
122122
uint64_t ExternCount{0};
123123
};
124124

125-
struct BranchInfo {
125+
struct TakenBranchInfo {
126126
uint64_t TakenCount{0};
127127
uint64_t MispredCount{0};
128128
};
129129

130130
/// Intermediate storage for profile data. We save the results of parsing
131131
/// and use them later for processing and assigning profile.
132-
std::unordered_map<Trace, BranchInfo, TraceHash> BranchLBRs;
132+
std::unordered_map<Trace, TakenBranchInfo, TraceHash> BranchLBRs;
133133
std::unordered_map<Trace, FTInfo, TraceHash> FallthroughLBRs;
134134
std::vector<AggregatedLBREntry> AggregatedLBRs;
135135
std::unordered_map<uint64_t, uint64_t> BasicSamples;

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ uint64_t DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14641464
uint64_t To = getBinaryFunctionContainingAddress(LBR.To) ? LBR.To : 0;
14651465
if (!From && !To)
14661466
continue;
1467-
BranchInfo &Info = BranchLBRs[Trace(From, To)];
1467+
TakenBranchInfo &Info = BranchLBRs[Trace(From, To)];
14681468
++Info.TakenCount;
14691469
Info.MispredCount += LBR.Mispred;
14701470
}
@@ -1609,7 +1609,7 @@ void DataAggregator::processBranchEvents() {
16091609

16101610
for (const auto &AggrLBR : BranchLBRs) {
16111611
const Trace &Loc = AggrLBR.first;
1612-
const BranchInfo &Info = AggrLBR.second;
1612+
const TakenBranchInfo &Info = AggrLBR.second;
16131613
doBranch(Loc.From, Loc.To, Info.TakenCount, Info.MispredCount);
16141614
}
16151615
}
@@ -2253,13 +2253,13 @@ DataAggregator::writeAggregatedFile(StringRef OutputFilename) const {
22532253
} else {
22542254
for (const auto &KV : NamesToBranches) {
22552255
const FuncBranchData &FBD = KV.second;
2256-
for (const llvm::bolt::BranchInfo &BI : FBD.Data) {
2256+
for (const BranchInfo &BI : FBD.Data) {
22572257
writeLocation(BI.From);
22582258
writeLocation(BI.To);
22592259
OutFile << BI.Mispreds << " " << BI.Branches << "\n";
22602260
++BranchValues;
22612261
}
2262-
for (const llvm::bolt::BranchInfo &BI : FBD.EntryData) {
2262+
for (const BranchInfo &BI : FBD.EntryData) {
22632263
// Do not output if source is a known symbol, since this was already
22642264
// accounted for in the source function
22652265
if (BI.From.IsSymbol)
@@ -2366,7 +2366,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23662366
return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
23672367
};
23682368

2369-
for (const llvm::bolt::BranchInfo &BI : Branches.Data) {
2369+
for (const BranchInfo &BI : Branches.Data) {
23702370
using namespace yaml::bolt;
23712371
const auto &[BlockOffset, BlockIndex] = getBlock(BI.From.Offset);
23722372
BinaryBasicBlockProfile &YamlBB = YamlBF.Blocks[BlockIndex];
@@ -2388,7 +2388,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23882388
}
23892389
}
23902390
// Set entry counts, similar to DataReader::readProfile.
2391-
for (const llvm::bolt::BranchInfo &BI : Branches.EntryData) {
2391+
for (const BranchInfo &BI : Branches.EntryData) {
23922392
if (!BlockMap.isInputBlock(BI.To.Offset)) {
23932393
if (opts::Verbosity >= 1)
23942394
errs() << "BOLT-WARNING: Unexpected EntryData in " << FuncName

0 commit comments

Comments
 (0)