[PATCH] D139794: [BOLT][NFC] DataAggregator code cleanup
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 11 11:36:35 PST 2022
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139794
Files:
bolt/lib/Profile/DataAggregator.cpp
Index: bolt/lib/Profile/DataAggregator.cpp
===================================================================
--- bolt/lib/Profile/DataAggregator.cpp
+++ bolt/lib/Profile/DataAggregator.cpp
@@ -644,13 +644,12 @@
processMemEvents();
// Mark all functions with registered events as having a valid profile.
+ const auto Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
+ : BinaryFunction::PF_LBR;
for (auto &BFI : BC.getBinaryFunctions()) {
BinaryFunction &BF = BFI.second;
- if (getBranchData(BF)) {
- const auto Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
- : BinaryFunction::PF_LBR;
+ if (getBranchData(BF))
BF.markProfiled(Flags);
- }
}
// Release intermediate storage.
@@ -727,17 +726,16 @@
From -= Func.getAddress();
To -= Func.getAddress();
- LLVM_DEBUG(dbgs() << "BOLT-DEBUG: bumpBranchCount: " << Func.getPrintName()
- << " @ " << Twine::utohexstr(From) << " -> "
- << Func.getPrintName() << " @ " << Twine::utohexstr(To)
- << '\n');
+ LLVM_DEBUG(dbgs() << formatv(
+ "BOLT-DEBUG: bumpBranchCount: {0} @ {1:x} -> {0} @ {2:x}\n",
+ Func.getPrintName(), From, To));
if (BAT) {
From = BAT->translate(Func.getAddress(), From, /*IsBranchSrc=*/true);
To = BAT->translate(Func.getAddress(), To, /*IsBranchSrc=*/false);
- LLVM_DEBUG(dbgs() << "BOLT-DEBUG: BAT translation on bumpBranchCount: "
- << Func.getPrintName() << " @ " << Twine::utohexstr(From)
- << " -> " << Func.getPrintName() << " @ "
- << Twine::utohexstr(To) << '\n');
+ LLVM_DEBUG(
+ dbgs() << formatv("BOLT-DEBUG: BAT translation on bumpBranchCount: {0} "
+ "@ {1:x} -> {0} @ {2:x}\n",
+ Func.getPrintName(), From, To));
}
AggrData->bumpBranchCount(From, To, Count, Mispreds);
@@ -1712,8 +1710,7 @@
BinaryFunction *Func = getBinaryFunctionContainingAddress(PC);
if (!Func) {
LLVM_DEBUG(if (PC != 0) {
- dbgs() << "Skipped mem event: 0x" << Twine::utohexstr(PC) << " => 0x"
- << Twine::utohexstr(Addr) << "\n";
+ dbgs() << formatv("Skipped mem event: {0:x} => {1:x}\n", PC, Addr);
});
continue;
}
@@ -2139,10 +2136,10 @@
<< BinaryMMapInfo.size() << " PID(s)\n";
LLVM_DEBUG({
- for (std::pair<const uint64_t, MMapInfo> &MMI : BinaryMMapInfo)
- outs() << " " << MMI.second.PID << (MMI.second.Forked ? " (forked)" : "")
- << ": (0x" << Twine::utohexstr(MMI.second.MMapAddress) << ": 0x"
- << Twine::utohexstr(MMI.second.Size) << ")\n";
+ for (const MMapInfo& MMI : llvm::make_second_range(BinaryMMapInfo))
+ outs() << formatv(" {0}{1}: ({2:x}: {3:x})\n", MMI.PID,
+ (MMI.Forked ? " (forked)" : ""), MMI.MMapAddress,
+ MMI.Size);
});
return std::error_code();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139794.481935.patch
Type: text/x-patch
Size: 3103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221211/b188b160/attachment.bin>
More information about the llvm-commits
mailing list