[llvm] [llvm-objdump] Optimize live element tracking (PR #158763)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 2 09:07:42 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;
----------------
gulfemsavrun wrote:
Thanks for the suggestion. I replaced `std::unordered_map` with `llvm::MapVector`.
https://github.com/llvm/llvm-project/pull/158763
More information about the llvm-commits
mailing list