[llvm] [llvm-objdump] Add support for symbolizing PGOBBAddrMap Info (PR #76386)
Rahman Lavaee via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 12:08:23 PST 2024
================
@@ -1638,18 +1691,24 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
LLVM_DEBUG(LVP.dump());
std::unordered_map<uint64_t, BBAddrMap> AddrToBBAddrMap;
+ std::unordered_map<uint64_t, PGOAnalysisMap> AddrToPGOAnalysisMap;
auto ReadBBAddrMap = [&](std::optional<unsigned> SectionIndex =
std::nullopt) {
AddrToBBAddrMap.clear();
if (const auto *Elf = dyn_cast<ELFObjectFileBase>(&Obj)) {
- auto BBAddrMapsOrErr = Elf->readBBAddrMap(SectionIndex);
+ std::vector<PGOAnalysisMap> PGOAnalyses;
+ auto BBAddrMapsOrErr = Elf->readBBAddrMap(SectionIndex, &PGOAnalyses);
if (!BBAddrMapsOrErr) {
reportWarning(toString(BBAddrMapsOrErr.takeError()), Obj.getFileName());
return;
}
- for (auto &FunctionBBAddrMap : *BBAddrMapsOrErr)
- AddrToBBAddrMap.emplace(FunctionBBAddrMap.Addr,
- std::move(FunctionBBAddrMap));
+ for (auto &&[FunctionBBAddrMap, FunctionPGOAnalysis] :
----------------
rlavaee wrote:
Thanks. I see what's happening now. Range over `zip_equal` returns a temporary tuple. So you can't take a non-const reference. `auto &&` is the right choice here. You can also use `zip_equal(*std::move(BBAddrMapsOrErr), std::move(PGOAnalyses))` to avoid unnecessary copies.
https://github.com/llvm/llvm-project/pull/76386
More information about the llvm-commits
mailing list