From 05bf27ac3f560cc798b20a352450d3b6bc20e72b Mon Sep 17 00:00:00 2001 From: Alex Shlyapnikov Date: Wed, 12 Apr 2017 20:51:42 +0000 Subject: [PATCH] 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 llvm-svn: 300103 --- compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h index e1172e0..a366194 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h @@ -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; -- 2.7.4