[llvm] [llvm-objdump] Add support for symbolizing PGOBBAddrMap Info (PR #76386)
Micah Weston via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 12:06:57 PST 2024
================
@@ -1708,13 +1702,12 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
reportWarning(toString(BBAddrMapsOrErr.takeError()), Obj.getFileName());
return;
}
- for (size_t I = 0; I < (*BBAddrMapsOrErr).size(); ++I) {
- uint64_t BBAddrMapAddr = (*BBAddrMapsOrErr)[I].Addr;
- AddrToBBAddrMap.emplace(BBAddrMapAddr,
- std::move((*BBAddrMapsOrErr)[I]));
- if (PGOAnalyses.size() > 0)
- AddrToPGOAnalysisMap.emplace(BBAddrMapAddr,
- std::move(PGOAnalyses[I]));
+ for (const auto &[FunctionBBAddrMap, FunctionPGOAnalysis] :
+ zip_equal(*BBAddrMapsOrErr, PGOAnalyses)) {
+ AddrToBBAddrMap.emplace(FunctionBBAddrMap.Addr, FunctionBBAddrMap);
+ if (FunctionPGOAnalysis.FeatEnable.anyEnabled())
+ AddrToPGOAnalysisMap.emplace(FunctionBBAddrMap.Addr,
+ FunctionPGOAnalysis);
----------------
red1bluelost wrote:
We want to keep the moves around to avoid copying multiple vectors that exist in BBAddrMap and PGOAnalysisMap.
```suggestion
for (auto &&[FunctionBBAddrMap, FunctionPGOAnalysis] :
zip_equal(*BBAddrMapsOrErr, PGOAnalyses)) {
uint64_t Addr = FunctionBBAddrMap.Addr;
AddrToBBAddrMap.emplace(Addr, std::move(FunctionBBAddrMap));
if (FunctionPGOAnalysis.FeatEnable.anyEnabled())
AddrToPGOAnalysisMap.emplace(Addr, std::move(FunctionPGOAnalysis));
```
https://github.com/llvm/llvm-project/pull/76386
More information about the llvm-commits
mailing list