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

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 08:47:00 PST 2025


================
@@ -142,13 +145,18 @@ void LiveElementPrinter::registerNewVariable() {
       "registerNewVariable called before element was added to LiveElements.");
   LiveVariable *CurrentVar =
       static_cast<LiveVariable *>(LiveElements.back().get());
+  assert(ElementPtrToIndex.count(CurrentVar) == 0 &&
+         "Element already registered!");
+
   // Map from a LiveElement pointer to its index in the LiveElements.
   ElementPtrToIndex[CurrentVar] = LiveElements.size() - 1;
 
-  if (const auto &Range = CurrentVar->getLocExpr().Range) {
+  if (const std::optional<DWARFAddressRange> &RangeOpt =
+          CurrentVar->getLocExpr().Range) {
+    const DWARFAddressRange &Range = *RangeOpt;
----------------
gulfemsavrun wrote:

Done.

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


More information about the llvm-commits mailing list