[compiler-rt] c172210 - [NFC][asan] Move AsanStats update
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 21 11:50:56 PDT 2023
Author: Vitaly Buka
Date: 2023-06-21T11:50:45-07:00
New Revision: c172210492f04664b5e2787df7257eb61c76cc4c
URL: https://github.com/llvm/llvm-project/commit/c172210492f04664b5e2787df7257eb61c76cc4c
DIFF: https://github.com/llvm/llvm-project/commit/c172210492f04664b5e2787df7257eb61c76cc4c.diff
LOG: [NFC][asan] Move AsanStats update
Deallocate is a more appropiate place to update free count.
Added:
Modified:
compiler-rt/lib/asan/asan_allocator.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_allocator.cpp b/compiler-rt/lib/asan/asan_allocator.cpp
index 5f26118d0e67a..c28e71c13885d 100644
--- a/compiler-rt/lib/asan/asan_allocator.cpp
+++ b/compiler-rt/lib/asan/asan_allocator.cpp
@@ -643,10 +643,6 @@ struct Allocator {
PoisonShadow(m->Beg(), RoundUpTo(m->UsedSize(), ASAN_SHADOW_GRANULARITY),
kAsanHeapFreeMagic);
- AsanStats &thread_stats = GetCurrentThreadStats();
- thread_stats.frees++;
- thread_stats.freed += m->UsedSize();
-
// Push into quarantine.
if (t) {
AsanThreadLocalMallocStorage *ms = &t->malloc_storage();
@@ -699,6 +695,10 @@ struct Allocator {
}
}
+ AsanStats &thread_stats = GetCurrentThreadStats();
+ thread_stats.frees++;
+ thread_stats.freed += m->UsedSize();
+
QuarantineChunk(m, ptr, stack);
}
More information about the llvm-commits
mailing list