[compiler-rt] [compiler-rt] Use __atomic builtins whenever possible (PR #84439)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 20:24:41 PDT 2024


Enna1 wrote:

> It looks like the store mo_release loop was unrolled here if I read this correctly.

I think you are right.

There are 56 stores/movb in `__sanitizer::InternalAllocatorUnlock()` x86 assemmby.
I have a look at the implementation of `__sanitizer::InternalAllocatorUnlock()`, https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp#L134

1.  The first store corresponds to https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_allocator_secondary.h#L272
2. The following 54 stores corresponds to unrolled loop at https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h#L247
The kNumClasses is 54 for SizeClassMap of PrimaryInternalAllocator.
3. The last store,  `movb	$0x0, 0x17bb74(%rip)` corresponds to `internal_allocator_cache_mu.Unlock()`


https://github.com/llvm/llvm-project/pull/84439


More information about the llvm-commits mailing list