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
9 lines
173 B
LLVM
9 lines
173 B
LLVM
; RUN: not llc -mtriple=bpf < %s 2> %t1
|
|
; RUN: FileCheck %s < %t1
|
|
; CHECK: unsupported signed division
|
|
|
|
define i32 @test(i32 %len) {
|
|
%1 = srem i32 %len, 15
|
|
ret i32 %1
|
|
}
|