[PATCH] D67123: [lldb] Early exit in RangeDataVector:FindEntryIndexesThatContain

Raphael Isemann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 04:39:02 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL370879: [lldb] Early exit in RangeDataVector:FindEntryIndexesThatContain (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67123?vs=218644&id=218645#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67123/new/

https://reviews.llvm.org/D67123

Files:
  lldb/trunk/include/lldb/Utility/RangeMap.h


Index: lldb/trunk/include/lldb/Utility/RangeMap.h
===================================================================
--- lldb/trunk/include/lldb/Utility/RangeMap.h
+++ lldb/trunk/include/lldb/Utility/RangeMap.h
@@ -724,12 +724,14 @@
 #ifdef ASSERT_RANGEMAP_ARE_SORTED
     assert(IsSorted());
 #endif
-
-    if (!m_entries.empty()) {
-      for (const auto &entry : m_entries) {
-        if (entry.Contains(addr))
-          indexes.push_back(entry.data);
-      }
+    // Search the entries until the first entry that has a larger base address
+    // than `addr`. As m_entries is sorted by their base address, all following
+    // entries can't contain `addr` as their base address is already larger.
+    for (const auto &entry : m_entries) {
+      if (entry.Contains(addr))
+        indexes.push_back(entry.data);
+      else if (entry.GetRangeBase() > addr)
+        break;
     }
     return indexes.size();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67123.218645.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190904/a9064b44/attachment.bin>


More information about the llvm-commits mailing list