diff options
author | Alexei Starovoitov <ast@kernel.org> | 2023-12-26 11:11:45 -0800 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-01-03 11:08:23 -0800 |
commit | 624cd2a17672f4596fee97a5558bc990778bbcf9 (patch) | |
tree | 8b24caf8e239bea1bbc4313d0f4a9aaed3c832e0 /net/unix/diag.c | |
parent | a8b242d77bd72556b7a9d8be779f7d27b95ba73c (diff) |
selftests/bpf: Convert exceptions_assert.c to bpf_cmp
Convert exceptions_assert.c to bpf_cmp_unlikely() macro.
Since
bpf_assert(bpf_cmp_unlikely(var, ==, 100));
other code;
will generate assembly code:
if r1 == 100 goto L2;
r0 = 0
call bpf_throw
L1:
other code;
...
L2: goto L1;
LLVM generates redundant basic block with extra goto. LLVM will be fixed eventually.
Right now it's less efficient than __bpf_assert(var, ==, 100) macro that produces:
if r1 == 100 goto L1;
r0 = 0
call bpf_throw
L1:
other code;
But extra goto doesn't hurt the verification process.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/bpf/20231226191148.48536-4-alexei.starovoitov@gmail.com
Diffstat (limited to 'net/unix/diag.c')
0 files changed, 0 insertions, 0 deletions