[all-commits] [llvm/llvm-project] ddf85b: [BPF] improve error handling by custom lowering & ...

Yingchi Long via All-commits all-commits at lists.llvm.org
Tue Dec 12 21:42:05 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ddf85b92aa53a0c205bf6c6b66fdb28ac1b9703b
      https://github.com/llvm/llvm-project/commit/ddf85b92aa53a0c205bf6c6b66fdb28ac1b9703b
  Author: Yingchi Long <i at lyc.dev>
  Date:   2023-12-13 (Wed, 13 Dec 2023)

  Changed paths:
    M llvm/lib/Target/BPF/BPFISelDAGToDAG.cpp
    M llvm/lib/Target/BPF/BPFISelLowering.cpp
    M llvm/lib/Target/BPF/BPFISelLowering.h
    A llvm/test/CodeGen/BPF/dynamic-stack.ll
    M llvm/test/CodeGen/BPF/sdiv_error.ll
    A llvm/test/CodeGen/BPF/srem_error.ll

  Log Message:
  -----------
  [BPF] improve error handling by custom lowering & fail() (#75088)

Currently on mcpu=v3 we do not support sdiv, srem instructions. And the
backend crashes with stacktrace & coredump, which is misleading for end
users, as this is not a "bug"

Add llvm bug reporting for sdiv/srem on ISel legalize-op phase.

For clang frontend we can get detailed location & bug report.

    $ build/bin/clang -g -target bpf -c local/sdiv.c
local/sdiv.c:1:35: error: unsupported signed division, please convert to
unsigned div/mod.
        1 | int sdiv(int a, int b) { return a / b; }
          |                                   ^
    1 error generated.

Fixes: #70433
Fixes: #48647

This also improves error handling for dynamic stack allocation:

    local/vla.c:2:3: error: unsupported dynamic stack allocation
        2 |   int b[n];
          |   ^
    1 error generated.

Fixes: https://github.com/llvm/llvm-project/issues/57171




More information about the All-commits mailing list