[llvm] [RFC][BPF] Report Unreachable Behavior from IR (PR #126858)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 21:50:06 PST 2025


yonghong-song wrote:

> > > I was curious if there are other cases besides switch instruction, where `unreachable` could survive up to codegen. Unfortunately, `unreachable` is generated in a lot of places with complex logic, e.g. loop fusion or SCCP. It looks like it is impossible to know the answer for sure.
> > 
> > 
> > Could you share the details about these experiments? I would like to see whether I missed anything which we should cover?
> 
> I did not do any experiments, tried to analyze places where `unreachable` is inserted and found logic to be too complex to try and produce any examples. E.g. `lvm/lib/Transforms/Scalar/LoopFuse.cpp` inserts `unreachable` in 6 places. W/o some understanding of loop fusion algorithm I can't produce an example.
> 
> One option would be to copy this transformation to x86 backend and e.g. compile Linux kernel or some other big project, to see which code patterns introduce `unreachable` in practice (if any). I can try it some time later.

Thanks. It would be great to collect some statistics. I only tried with bpf programs in kernel bpf selftests. Maybe trying with other architectures can expose more patterns.

https://github.com/llvm/llvm-project/pull/126858


More information about the llvm-commits mailing list