[llvm] [llvm-objdump] Optimize live element tracking (PR #158763)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 01:51:55 PST 2025


================
@@ -126,8 +121,18 @@ 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());
+  // Map the element's high address (HighPC) to its pointer for fast range end
+  // lookup.
+  LiveElementsByEndAddress[FuncHighPC].push_back(LiveElements.back().get());
+  // Map the pointer to its DWARF discovery index (ElementIdx) for deterministic
----------------
jh7370 wrote:

Same comment as elsewhere "ElementIdx" in this context is not really a useful term. Better would be to say what is meant by "discovery index".

https://github.com/llvm/llvm-project/pull/158763


More information about the llvm-commits mailing list