[llvm] [llvm-objdump] Optimize live element tracking (PR #158763)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 5 11:19:28 PST 2025
================
@@ -440,20 +568,60 @@ void LiveElementPrinter::printAfterInst(formatted_raw_ostream &OS) {
void LiveElementPrinter::printStartLine(formatted_raw_ostream &OS,
object::SectionedAddress Addr) {
- // Print a line to idenfity the start of an inlined function if line format
- // is specified.
- if (DbgInlinedFunctions == DFLimitsOnly)
- for (const std::unique_ptr<LiveElement> &LE : LiveElements)
- LE->printElementLine(OS, Addr, false);
+ // Only print the start line for inlined functions if DFLimitsOnly is
+ // enabled.
+ if (DbgInlinedFunctions != DFLimitsOnly)
+ return;
+
+ // Use the map to find all elements that start at the given address.
+ std::vector<unsigned> ElementIndices;
+ auto It = LiveElementsByAddress.find(Addr.Address);
+ if (It != LiveElementsByAddress.end()) {
+ for (LiveElement *LE : It->second) {
+ // Look up the ElementIdx from the pointer.
+ auto IndexIt = ElementPtrToIndex.find(LE);
+ if (IndexIt != ElementPtrToIndex.end())
----------------
gulfemsavrun wrote:
It is more reasonable to convert this into an assertion. As long as live elements are correctly populated across all data structures, `IndexIt` will never equal the end iterator.
https://github.com/llvm/llvm-project/pull/158763
More information about the llvm-commits
mailing list