[llvm] [llvm-objdump] Add support for symbolizing PGOBBAddrMap Info (PR #76386)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 6 14:50:15 PST 2024
================
@@ -1638,18 +1685,27 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
LLVM_DEBUG(LVP.dump());
std::unordered_map<uint64_t, BBAddrMap> AddrToBBAddrMap;
+ std::unordered_map<uint64_t, PGOAnalysisMap> AddrToPGOBBAddrMap;
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 (size_t I = 0; I < (*BBAddrMapsOrErr).size(); ++I) {
+ AddrToBBAddrMap.emplace((*BBAddrMapsOrErr)[I].Addr,
+ std::move((*BBAddrMapsOrErr)[I]));
+ if (PGOAnalyses.size() > 0)
+ AddrToPGOBBAddrMap.emplace((*BBAddrMapsOrErr)[I].Addr,
----------------
boomanaiden154 wrote:
Good catch. Also forgot to remove the range-based for loop above that was duplicating work when I converted to a index-based for loop.
https://github.com/llvm/llvm-project/pull/76386
More information about the llvm-commits
mailing list