Before I move on from this topic, I wanted to share an interesting paper I came across while trying to understand exactly how the unreachable
instruction is used by LLVM: https://dl.acm.org/doi/pdf/10.1145/3656404.
TL;DR: the example I gave is definitely a missed optimization.
3 Likes