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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 10:53:04 PDT 2025


================
@@ -97,11 +98,22 @@ class LiveElementPrinter {
         std::numeric_limits<unsigned>::max();
   };
 
-  // All live elements we know about in the object/image file.
+  // Vector that owns all LiveElement objects for memory management.
   std::vector<std::unique_ptr<LiveElement>> LiveElements;
-
-  // The columns we are currently drawing.
-  IndexedMap<Column> ActiveCols;
+  // Map for fast lookup of live elements by their starting address (LowPC).
+  std::unordered_multimap<uint64_t, LiveElement *> LiveElementsByAddress;
+  // Map for fast lookup of live elements by their ending address (HighPC).
+  std::unordered_multimap<uint64_t, LiveElement *> LiveElementsByEndAddress;
+  // Map from a LiveElement pointer to its index in the LiveElements vector.
+  std::unordered_map<LiveElement *, unsigned> ElementPtrToIndex;
----------------
jh7370 wrote:

I suspect you're better off with one of LLVM's map types, based on the discussion at https://llvm.org/docs/ProgrammersManual.html#other-map-like-container-options.

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


More information about the llvm-commits mailing list