[PATCH] D34433: [Sanitizers] 32 bit allocator respects allocator_may_return_null flag

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 16:08:28 PDT 2017


eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/sanitizer_common/sanitizer_allocator_local_cache.h:147
     PerClass *c = &per_class_[class_id];
-    if (UNLIKELY(c->count == 0))
-      Refill(allocator, class_id);
+    if (UNLIKELY(c->count == 0 && !Refill(allocator, class_id)))
+      return nullptr;
----------------
alekseyshl wrote:
> cryptoad wrote:
> > Doing it this way, we are losing the 'unlikeliness' of `c->count == 0`.
> > I am not sure this will matter much though.
> Let's bring it back then.
unnecessary {} 


================
Comment at: lib/sanitizer_common/sanitizer_allocator_primary32.h:284
+        kRegionSize, kRegionSize, "SizeClassAllocator32"));
+    if (res) {
+      MapUnmapCallback().OnMap(res, kRegionSize);
----------------
early exit
do we need UNLIKELY here? probably not.


https://reviews.llvm.org/D34433





More information about the llvm-commits mailing list