[PATCH] D107554: [DWARF][Verifier] Do not add child DieRangeInfo with empty address range to the parent.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 04:11:08 PDT 2021


avl created this revision.
avl added reviewers: JDevlieghere, dblaikie, clayborg.
Herald added a subscriber: hiraditya.
avl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

verifyDieRanges function checks for the intersected address ranges.
It adds child DieRangeInfo into parent DieRangeInfo to check
whether children have overlapping address ranges. It is safe to not add
DieRangeInfo with empty address range into parent's children list.
This decreases the number of children which should be navigated and as a result
decreases execution time(parents having a lot of children with empty ranges
spend much time navigating them). For this command: "llvm-dwarfdump --verify clang-repl"
execution time decreased from 220 sec till 75 sec.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107554

Files:
  llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -434,17 +434,19 @@
       dump(Die, 2) << '\n';
   }
 
-  // Verify that children don't intersect.
-  const auto IntersectingChild = ParentRI.insert(RI);
-  if (IntersectingChild != ParentRI.Children.end()) {
-    ++NumErrors;
-    error() << "DIEs have overlapping address ranges:";
-    dump(Die);
-    dump(IntersectingChild->Die) << '\n';
+  if (!RI.Ranges.empty()) {
+    // Verify that children don't intersect.
+    const auto IntersectingChild = ParentRI.insert(RI);
+    if (IntersectingChild != ParentRI.Children.end()) {
+      ++NumErrors;
+      error() << "DIEs have overlapping address ranges:";
+      dump(Die);
+      dump(IntersectingChild->Die) << '\n';
+    }
   }
 
   // Verify that ranges are contained within their parent.
-  bool ShouldBeContained = !Ranges.empty() && !ParentRI.Ranges.empty() &&
+  bool ShouldBeContained = !RI.Ranges.empty() && !ParentRI.Ranges.empty() &&
                            !(Die.getTag() == DW_TAG_subprogram &&
                              ParentRI.Die.getTag() == DW_TAG_subprogram);
   if (ShouldBeContained && !ParentRI.contains(RI)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107554.364410.patch
Type: text/x-patch
Size: 1312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210805/c7f20cca/attachment.bin>


More information about the llvm-commits mailing list