[all-commits] [llvm/llvm-project] 2fca0e: [BPF] fix sub-register handling for bpf_fastcall (...

eddyz87 via All-commits all-commits at lists.llvm.org
Tue Oct 1 11:20:44 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fca0effb4e1cbb620b7f21e9b867198ba20028a
      https://github.com/llvm/llvm-project/commit/2fca0effb4e1cbb620b7f21e9b867198ba20028a
  Author: eddyz87 <eddyz87 at gmail.com>
  Date:   2024-10-01 (Tue, 01 Oct 2024)

  Changed paths:
    M llvm/lib/Target/BPF/BPFMIPeephole.cpp
    A llvm/test/CodeGen/BPF/bpf-fastcall-4.ll
    A llvm/test/CodeGen/BPF/bpf-fastcall-5.ll

  Log Message:
  -----------
  [BPF] fix sub-register handling for bpf_fastcall (#110618)

bpf_fastcall induced spill/fill pairs should be generated for
sub-register as well as for sub-registers. At the moment this is not the
case, e.g.:

    $ cat t.c
    extern int foo(void) __attribute__((bpf_fastcall));

    int bar(int a) {
      foo();
      return a;
    }

    $ clang --target=bpf -mcpu=v3 -O2 -S t.c -o -
    ...
    call foo
    w0 = w1
    exit

Modify BPFMIPeephole.cpp:collectBPFFastCalls() to check sub-registers
liveness and thus produce correct code for example above:

    *(u64 *)(r10 - 8) = r1
    call foo
    r1 = *(u64 *)(r10 - 8)
    w0 = w1
    exit



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list