On Wed, Sep 23, 2020 at 9:15 AM Lorenz Bauer <lmb@xxxxxxxxxxxxxx> wrote: > > On Wed, 23 Sep 2020 at 08:17, Yonghong Song <yhs@xxxxxx> wrote: > > > > Hi, > > > > I have spent some time to add additional logic in llvm BPF backend > > in order to generate verifier friendly code. > > > > The first patch is: > > https://reviews.llvm.org/D87153 > > which moves CORE relocation builtin handling from in late IR > > optimization (after inlining and major optimizations) > > to in early IR optimization (before inlining and any optimizations). > > The reason is to prevent harmful CSEs. > > > > But this change may change how compiler do optimizations. > > The patch can pass bpf selftests in latest bpf-next. > > Andrii helped it can also pass bcc/libbpf-tools. > > > > If your code uses COREs, esp. having a lot of subroutines > > and/or loops, it would be good to give a try with new patch > > to see whether there are any issues or not. In my case, > > for one of our internal applications with lots of subroutines > > and loops, inlining all subroutines and unrolling all loops > > will cause register spills which cannot be handled by > > the verifier, while existing llvm won't have issue. > > Hi Yonghong, > > We currently don't use CORE (outside of bcc, etc.), so there isn't > much I can test I guess? Please let me know if there is something I > can do for your follow up patches. > It would still be good if you could test all three Clang/LLVM patches Yonghong referenced. The latter two are not CO-RE-specific. Thanks! And pedantic nit: BCC doesn't use CO-RE, it just does runtime compilation using local kernel headers with exact memory layout of kernel structs. > Best > Lorenz > > -- > Lorenz Bauer | Systems Engineer > 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK > > www.cloudflare.com