[compiler-rt] r300103 - Avoid calling SizeClassMap::MaxCachedHint on hot path, it's not free.

Alex Shlyapnikov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 13:51:42 PDT 2017


Author: alekseyshl
Date: Wed Apr 12 15:51:42 2017
New Revision: 300103

URL: http://llvm.org/viewvc/llvm-project?rev=300103&view=rev
Log:
Avoid calling SizeClassMap::MaxCachedHint on hot path, it's not free.

Summary: Remove unecessary SizeClassMap::MaxCachedHint call.

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

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

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_local_cache.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_local_cache.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_local_cache.h?rev=300103&r1=300102&r2=300103&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_local_cache.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_local_cache.h Wed Apr 12 15:51:42 2017
@@ -102,7 +102,7 @@ struct SizeClassAllocator64LocalCache {
   NOINLINE void Refill(PerClass *c, SizeClassAllocator *allocator,
                        uptr class_id) {
     InitCache();
-    uptr num_requested_chunks = SizeClassMap::MaxCachedHint(class_id);
+    uptr num_requested_chunks = c->max_count / 2;
     allocator->GetFromAllocator(&stats_, class_id, c->chunks,
                                 num_requested_chunks);
     c->count = num_requested_chunks;




More information about the llvm-commits mailing list