[llvm] [llvm-objdump] Optimize live element tracking (PR #158763)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 20 01:16:26 PST 2025
================
@@ -126,8 +121,35 @@ void LiveElementPrinter::addInlinedFunction(DWARFDie FuncDie,
DWARFUnit *U = InlinedFuncDie.getDwarfUnit();
const char *InlinedFuncName = InlinedFuncDie.getName(DINameKind::LinkageName);
DWARFAddressRange Range{FuncLowPC, FuncHighPC, SectionIndex};
+ // Add the new element to the main vector.
LiveElements.emplace_back(std::make_unique<InlinedFunction>(
InlinedFuncName, U, FuncDie, InlinedFuncDie, Range));
+ // Map the element's low address (LowPC) to its pointer for fast range start
+ // lookup.
+ LiveElementsByAddress[FuncLowPC].push_back(LiveElements.back().get());
----------------
jh7370 wrote:
It's probably worth storing `LiveElements.back().get()` in a local variable, to save repeating it three times.
https://github.com/llvm/llvm-project/pull/158763
More information about the llvm-commits
mailing list