[PATCH] D46657: [sanitizer] Minor 32-bit primary improvements

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 14:38:55 PDT 2018


cryptoad added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_allocator_local_cache.h:192
       while (c->count > 0)
-        Drain(c, allocator, i);
+        Drain(c, allocator, i, Min(c->max_count / 2, c->count));
     }
----------------
alekseyshl wrote:
> Why the loop, why don't we drain the class in one call?
> 
>   Drain(c, allocator, i, c->count);
> 
> We used to have to have a loop because of the Drain API, but now we can specify the number of elements to drain.
Since the `TransferBatch` that we are using can only hold `max_count / 2`, we can't directly drain `count`.
I could change it to something like  if `count > max_count / 2` then we can drain `max_count / 2`, then drain `count` elements.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D46657





More information about the llvm-commits mailing list