[compiler-rt] r302530 - Avoid unnecessary calls to vm_region_recurse

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 07:10:30 PDT 2017


Author: fjricci
Date: Tue May  9 09:10:30 2017
New Revision: 302530

URL: http://llvm.org/viewvc/llvm-project?rev=302530&view=rev
Log:
Avoid unnecessary calls to vm_region_recurse

Summary: This should significantly improve darwin lsan performance in cases where root regions are not used.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D32966

Modified:
    compiler-rt/trunk/lib/lsan/lsan_common_mac.cc

Modified: compiler-rt/trunk/lib/lsan/lsan_common_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common_mac.cc?rev=302530&r1=302529&r2=302530&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common_mac.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common_mac.cc Tue May  9 09:10:30 2017
@@ -144,6 +144,11 @@ void ProcessPlatformSpecificAllocations(
     if (info.user_tag == VM_MEMORY_OS_ALLOC_ONCE) {
       ScanRangeForPointers(address, end_address, frontier, "GLOBAL",
                            kReachable);
+
+      // Recursing over the full memory map is very slow, break out
+      // early if we don't need the full iteration.
+      if (!flags()->use_root_regions || !root_regions->size())
+        break;
     }
 
     // This additional root region scan is required on Darwin in order to




More information about the llvm-commits mailing list