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

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 10:41:42 PST 2024


arichardson wrote:

> Hi Alexander,
> 
> Thanks for working on this.
> 
> Please double-check that codegen for the following tsan functions in release builds don't change: __tsan_read1/2/4/8, __tsan_write1/2/4/8, __tsan_func_entry/exit. Please post diff of asm for these functions, if any.
> 
> If we are refacatoring this, can we simplify code more today? I guess Vistual Studio does not support these buitlins, so we can't just switch to them. But perhaps we could switch to std::atomic? If yes, I would assume we still keep the atomic operation wrapper functions to minimize the diff.
> 
> Also clang-format CI check complains, please re-format the code.

Which architectures do you care about for these diffs? X86 should be easiest to generate, but I can also show AArch64, which might actually be better considering it has a weaker memory model?

The reason I did not use std::atomic is that I was under the assumption that we can't rely on the C++ standard library here and have to roll our own.

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


More information about the llvm-commits mailing list