[clang] [clang] Better bitfield access units (PR #65742)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 10:34:09 PDT 2023


yonghong-song wrote:

With this pull request, I tried to build linux kernel and kernel bpf selftest and run the selftest, and didn't find any issues. So presumably the implementation is correct.

I tried a particular kernel bpf selftest:
  https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/test_tunnel_kern.c#L39-L42
which has a few bitfield usages.
The generated code is the same with or without this change.
The bitfield patterns in the above test_tunnel_kern.c is pretty typical in kernel which is pro
aligned bitfields. This patch tries to handle some cases better for not-commonly-used bitfield patterns, those patterns (like the one in the pull request summary) are very rare in bpf program or kernel, so I guess it should have minimum impact on BPF backend.

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


More information about the cfe-commits mailing list