[compiler-rt] e403fd8 - [HWASAN] Add unlikely to if in HwasanAllocate.

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 16:41:31 PST 2023


Author: Kirill Stoimenov
Date: 2023-02-07T00:39:17Z
New Revision: e403fd8705dc1c3e38ed50fa9b5ff946368421e6

URL: https://github.com/llvm/llvm-project/commit/e403fd8705dc1c3e38ed50fa9b5ff946368421e6
DIFF: https://github.com/llvm/llvm-project/commit/e403fd8705dc1c3e38ed50fa9b5ff946368421e6.diff

LOG: [HWASAN] Add unlikely to if in HwasanAllocate.

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_allocator.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index ec52741e3fd6..812ae78e71e4 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -165,7 +165,7 @@ static void *HwasanAllocate(StackTrace *stack, uptr orig_size, uptr alignment,
   // Keep this consistent with LSAN and ASAN behavior.
   if (UNLIKELY(orig_size == 0))
     orig_size = 1;
-  if (orig_size > kMaxAllowedMallocSize) {
+  if (UNLIKELY(orig_size > kMaxAllowedMallocSize)) {
     if (AllocatorMayReturnNull()) {
       Report("WARNING: HWAddressSanitizer failed to allocate 0x%zx bytes\n",
              orig_size);


        


More information about the llvm-commits mailing list