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

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 24 02:32:04 PDT 2024


================
@@ -35,6 +35,15 @@ static const char *BTFKindStr[] = {
 #include "llvm/DebugInfo/BTF/BTF.def"
 };
 
+static const DIType *tryRemoveAtomicType(const DIType *Ty) {
----------------
eddyz87 wrote:

I meant that it seems that `tryRemoveAtomicType` is missing from `BTFTypeTypeTag::completeType`, e.g. the following example drops type tag:

```
$ cat test5.c 
int _Atomic __attribute__((btf_type_tag("foo"))) *root;

$ clang -c --target=bpf -g test5.c -O2 -o test5.o && bpftool btf dump file test5.o
[1] PTR '(anon)' type_id=2
[2] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED
[3] VAR 'root' type_id=1, linkage=global
[4] DATASEC '.bss' size=0 vlen=1
	type_id=3 offset=0 size=8 (VAR 'root')
```

As far as I understand, expected output is:

```
[1] TYPE_TAG 'foo' type_id=3
[2] PTR '(anon)' type_id=1
[3] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED
[4] VAR 'root' type_id=2, linkage=global
[5] DATASEC '.bss' size=0 vlen=1
	type_id=4 offset=0 size=8 (VAR 'root')
```

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


More information about the cfe-commits mailing list