[llvm] [BPF] Handle nested wrapper structs in BPF map definition traversal (PR #144097)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 10:02:48 PDT 2025
================
@@ -0,0 +1,606 @@
+; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK-SHORT %s
+; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
+
+; Source code:
----------------
eddyz87 wrote:
Could you please try to minimize your test case?
As far as I understand, the intended use case looks as follows in C:
```c
$ cat test_struct_dbg.c
struct foo { int i; };
struct bar { int j; };
struct key { struct foo *f; };
struct vak { struct bar *b; };
#define __uint(name, val) int (*name)[val]
#define __type(name, val) typeof(val) *name
struct {
__uint(type, 1);
__uint(max_entries, 1);
__type(key, struct key);
__type(value, struct val);
} map __attribute__((section(".maps")));
```
And it generates a much smaller amount of IR:
``` bash
$ clang -g -emit-llvm -S test_struct_dbg.c -o - | wc -l
47
```
https://github.com/llvm/llvm-project/pull/144097
More information about the llvm-commits
mailing list