[llvm] [RFC][BPF] Do atomic_fetch_*() pattern matching with memory ordering (PR #107343)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 21:54:12 PDT 2024


yonghong-song wrote:

> Question: should BPF backend report and error if `__ATOMIC_{CONSUME,ACQUIRE,RELEASE,ACQ_REL}` is used?
> LLVM documentation [allows this](https://llvm.org/docs/Atomics.html#unordered).
> Edit: currently `clang` crashes with a backtrace if one of these is used, probably better to report an error in a more user friendly way.

Agree that Issuing an error message is more user friendly. Also __ATOMIC_CONSUME is an variant of __ATOMIC_ACQUIRE but looks like they may have subtle difference. In https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/_005f_005fatomic-Builtins.html
```
__ATOMIC_CONSUME
    Data dependency only for both barrier and synchronization with another thread.
__ATOMIC_ACQUIRE
    Barrier to hoisting of code and synchronizes with release (or stronger) semantic stores from another thread. 
```
Linux kernel does not support __ATOMIC_CONSUME. So BPF backend may not support it anytime soon.



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


More information about the llvm-commits mailing list