[PATCH] D154749: [BOLT][NFC] Simplify DataAggregator/YAMLProfileReader
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 14:52:30 PDT 2023
Amir updated this revision to Diff 545821.
Amir added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154749/new/
https://reviews.llvm.org/D154749
Files:
bolt/lib/Profile/DataAggregator.cpp
Index: bolt/lib/Profile/DataAggregator.cpp
===================================================================
--- bolt/lib/Profile/DataAggregator.cpp
+++ bolt/lib/Profile/DataAggregator.cpp
@@ -1479,13 +1479,10 @@
NumTraces += parseLBRSample(Sample, NeedsSkylakeFix);
}
- for (const auto &LBR : BranchLBRs) {
- const Trace &Trace = LBR.first;
- if (BinaryFunction *BF = getBinaryFunctionContainingAddress(Trace.From))
- BF->setHasProfileAvailable();
- if (BinaryFunction *BF = getBinaryFunctionContainingAddress(Trace.To))
- BF->setHasProfileAvailable();
- }
+ for (const Trace &Trace : llvm::make_first_range(BranchLBRs))
+ for (const uint64_t Addr : {Trace.From, Trace.To})
+ if (BinaryFunction *BF = getBinaryFunctionContainingAddress(Addr))
+ BF->setHasProfileAvailable();
auto printColored = [](raw_ostream &OS, float Percent, float T1, float T2) {
OS << " (";
@@ -1721,12 +1718,9 @@
if (std::error_code EC = AggrEntry.getError())
return EC;
- if (BinaryFunction *BF =
- getBinaryFunctionContainingAddress(AggrEntry->From.Offset))
- BF->setHasProfileAvailable();
- if (BinaryFunction *BF =
- getBinaryFunctionContainingAddress(AggrEntry->To.Offset))
- BF->setHasProfileAvailable();
+ for (const uint64_t Addr : {AggrEntry->From.Offset, AggrEntry->To.Offset})
+ if (BinaryFunction *BF = getBinaryFunctionContainingAddress(Addr))
+ BF->setHasProfileAvailable();
AggregatedLBRs.emplace_back(std::move(AggrEntry.get()));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154749.545821.patch
Type: text/x-patch
Size: 1559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230731/2ad097c9/attachment.bin>
More information about the llvm-commits
mailing list