================
@@ -57,18 +86,19 @@ void MemoryCache::Flush(addr_t addr, size_t size) {
 
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
-  // Erase any blocks from the L1 cache that intersect with the flush range
+  // Erase any blocks from the L1 cache that intersect with the flush range. A
+  // chunk that intersects cannot start earlier than this, so scan a bounded
+  // window rather than the whole cache.
   if (!m_L1_cache.empty()) {
     AddrRange flush_range(addr, size);
-    BlockMap::iterator pos = m_L1_cache.upper_bound(addr);
-    if (pos != m_L1_cache.begin()) {
-      --pos;
-    }
-    while (pos != m_L1_cache.end()) {
+    addr_t lowest_possible_start = GetLowestPossibleChunkStart(addr);
----------------
felipepiovezan wrote:

Ah, it's this.
I think the comment is slightly out of place, but IMO we can remove it: the 
name of this variable is already saying exactly what happens

https://github.com/llvm/llvm-project/pull/208347
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to